我做了一个测试:curl anhk.cc -x 127.1:80 -Sv -H"X:X" -H"Y:Y"
server {
server_name anhk.cc;
listen *:80;
more_set_headers "A:A"; ## 可以添加
location / {
more_set_headers "B:B"; ## 可以添加
if ($http_y) {
more_set_headers "Y:Y"; ## 主要是这个Y,无法添加成功
}
location / {
if ($http_x) {
more_set_headers "X:X"; ## 可以添加
}
more_set_headers "C:C"; ## 可以添加
content_by_lua_block {
ngx.say("Hello World!")
}
}
}
}