-
Notifications
You must be signed in to change notification settings - Fork 106
Add user-defined headers before forward response to client #872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b5aab83
add user defined headers before forwarding responses to client
vankoven 0af57a9
func tests: add tests for 'add_hdr' directive
vankoven fff9168
add_hdr directive: correct follow and override of global settings
vankoven 3fe5aec
modify request and response headers before forwarding
vankoven 1fc4745
fix duplicated indexes in array in __http_msg_hdr_val()
vankoven 57c364a
increment header table size when appending a new raw header to http m…
vankoven e4936f9
Merge branch 'master' into ik-add-user-hdr
vankoven 1df692c
Merge branch 'master' into ik-add-user-hdr
vankoven 8b52135
fix merge error
vankoven e0313b3
fix code review comments
vankoven 925621c
fix code review comments by @krizhanovsky
vankoven b3a38f9
fix code review comments by @aleksostapenko
vankoven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, make sense. But isn't it better to leave only one configuration option like
req_hdr_xfrm
? E.g. to add or replace content ofX-Forwarded-For
(as oposite to current hardcoded version it replaces the header if it's present in the request:or to remove we just omit the value:
Just like
tfw_http_msg_hdr_xfrm()
. The same for responses.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only difference between
req_hdr_add
andreq_hdr_set
is ability of_add
to append user defined string to the existing header. In this case original value of header will be saved, but a user defined string will be added to the header. If the feature is not required,req_hdr_add
directive can be easily removed.E.g. for the configuration
resp_hdr_add Set-Cookie "ck=djnfsdnfkdn"
the headerSet-Cookie: c=fvfkm
will be transformed intoSet-Cookie: c=fvfkm, ck=djnfsdnfkdn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So
resp_hdr_set
deletes a header, adds it to a HTTP message or replaces a header if it's already present, is it correct? If so, then please describe the difference in https://github.com/tempesta-tech/tempesta/wiki/Modify-HTTP-Messages , preferably with some examples.