nginx-向上游添加自定义标头

时间:2018-09-14 14:32:57

标签: http nginx http-headers reverse-proxy

我正在尝试使用nginx将一些其他自定义请求标头设置为上游。但它不起作用(未设置标头)。任何帮助将不胜感激。

location /someUrl {
    proxy_pass_request_headers on;
    proxy_set_header Test ABCDE;
    proxy_pass http://example.com;
}

1 个答案:

答案 0 :(得分:0)

尝试颠倒设置顺序,例如:

location /someUrl {
   proxy_pass http://example.com;
   proxy_set_header Test ABCDE;
   proxy_pass_request_headers on;
}

我以前见过此修复程序,但是无法解释它的文档中没有任何内容。