Skip to content

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

Description

@840963657

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):

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions