-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
copy_response_headers
, with include/exclude list support
- Loading branch information
1 parent
a45963d
commit 2201ad3
Showing
5 changed files
with
259 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ var directiveOrder = []string{ | |
"root", | ||
|
||
"header", | ||
"copy_response_headers", | ||
"request_body", | ||
|
||
"redir", | ||
|
This file contains 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
:8884 | ||
|
||
reverse_proxy 127.0.0.1:65535 { | ||
@accel header X-Accel-Redirect * | ||
handle_response @accel { | ||
respond "Header X-Accel-Redirect!" | ||
} | ||
|
||
@another { | ||
header X-Another * | ||
} | ||
handle_response @another { | ||
respond "Header X-Another!" | ||
} | ||
|
||
@401 status 401 | ||
handle_response @401 { | ||
respond "Status 401!" | ||
} | ||
|
||
handle_response { | ||
respond "Any! This should be last in the JSON!" | ||
} | ||
|
||
@403 { | ||
status 403 | ||
} | ||
handle_response @403 { | ||
respond "Status 403!" | ||
} | ||
|
||
@multi { | ||
status 401 403 | ||
status 404 | ||
header Foo * | ||
header Bar * | ||
} | ||
handle_response @multi { | ||
respond "Headers Foo, Bar AND statuses 401, 403 and 404!" | ||
} | ||
|
||
@changeStatus status 500 | ||
handle_response @changeStatus 400 | ||
|
||
@200 status 200 | ||
handle_response @200 { | ||
copy_response_headers { | ||
include Foo Bar | ||
} | ||
respond "Copied headers from the response" | ||
} | ||
|
||
@201 status 201 | ||
handle_response @201 { | ||
header Foo "Copying the response" | ||
copy_response 404 | ||
} | ||
} |
This file contains 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 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