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

bug: response-rewrite : The format validation for headers.add is unreasonable. #9223

Closed
840963657 opened this issue Apr 3, 2023 · 2 comments · Fixed by #9372
Closed

bug: response-rewrite : The format validation for headers.add is unreasonable. #9223

840963657 opened this issue Apr 3, 2023 · 2 comments · Fixed by #9372
Assignees
Labels
bug Something isn't working

Comments

@840963657
Copy link
Contributor

Current Behavior

response-rewrite plugin Configuration Information:
"plugins": {
"response-rewrite": {
"headers": {
"add": [
"X-Server-test:a"
]
}
}
}

error Information
{"error_msg":"failed to check the configuration of plugin response-rewrite err: property "headers" validation failed: object matches none of the required"}

Expected Behavior

The parameter value should be able to contain a single character.

I think this regular expression is incorrect:
response-rewrite.lua:55
add = {
type = "array",
minItems = 1,
items = {
type = "string",
-- "Set-Cookie: =; Max-Age="
pattern = "^[^:]+:[^:]+[^/]$"
}

Error Logs

{"error_msg":"failed to check the configuration of plugin response-rewrite err: property "headers" validation failed: object matches none of the required"}

Steps to Reproduce

add response-rewrite plugin;
Configure the headers.add value to be a single character

Environment

  • APISIX version (run apisix version):3.2
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@kayx23
Copy link
Member

kayx23 commented Apr 26, 2023

Just throwing in some tests.

Testing with X-Server-test: a andX-Server-test:a

image

image

Testing with hello:world
image

@kayx23
Copy link
Member

kayx23 commented Apr 26, 2023

Testing with Cache-Control: no-cache and Cache-Control:no-cache
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants