Skip to content
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

feat: proxy-rewrite support config add set and remove header #8336

Merged
merged 22 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apisix/plugins/proxy-rewrite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ local function check_set_headers(headers)
if #field == 0 then
return false, 'invalid field length in header'
end

core.log.info("header field: ", field)
tokers marked this conversation as resolved.
Show resolved Hide resolved
if not core.utils.validate_header_field(field) then
return false, 'invalid field character in header'
end
Expand Down
16 changes: 11 additions & 5 deletions t/plugin/proxy-rewrite3.t
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ X-Forwarded-Host: test.com
[error]


=== TEST 14: try config header: add, set, remove

=== TEST 14: set route add test
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -381,7 +382,8 @@ passed
[error]


=== TEST 15: test add exist header in muti-header is working

=== TEST 15: add exist header in muti-header
--- request
GET /echo HTTP/1.1
--- more_headers
Expand All @@ -393,7 +395,8 @@ test: sssss, bbb, 123
[error]


=== TEST 16: test add header to exist header is working

=== TEST 16: add header to exist header
--- request
GET /echo HTTP/1.1
--- more_headers
Expand All @@ -404,7 +407,8 @@ test: sssss, 123
[error]


=== TEST 17: test remove header

=== TEST 17: remove header
--- request
GET /echo HTTP/1.1
--- more_headers
Expand All @@ -415,7 +419,9 @@ hello:
[error]


=== TEST 18: test add header success

=
== TEST 18: remove header success
--- request
GET /echo HTTP/1.1
--- response_headers
Expand Down