代理服务器节点重定向时,Nginx无法接收自定义标头

时间:2017-05-13 12:13:54

标签: node.js express nginx nginx-location

我正在运行一个NGINX服务器,指向我在Node上运行的代理服务器。我使用 { "-Kk0GA4lzQ5Ze8TEaYfS" : { "address" : "bhandup", "age" : 30, "firstName" : "aaa", "lastName" : "aaa" }, "-Kk0GZ9gp9QqGHRImQ9E" : { "address" : "sasdas", "age" : 29, "firstName" : "test", "lastName" : "test" }, "-Kk0GpCy05DkoJaYwlJG" : { "address" : "test", "age" : 10, "firstName" : "test", "lastName" : "test" }, "-Kk0JUU91nqeSXmkx_pq" : { "address" : "abc", "age" : 23, "firstName" : "abc", "lastName" : "abc" }, "-Kk0Jj6rEgxLJLqtMmtf" : { "address" : "jk", "age" : 23, "firstName" : "abs", "lastName" : "abd" }, "-Kk0KzS2LU3AVHxut788" : { "address" : "kjkj", "age" : 23, "firstName" : "aha", "lastName" : "hsh" }, "-Kk0M9hewdpfNSeiT8C4" : { "address" : "testlast", "age" : 10, "firstName" : "testlat", "lastName" : "testlast" } } 从节点重定向到app/。我还在重定向之前使用express redirect传递自定义标头。但是在NGINX上的res.set("X-Custom-Header","XXX");路由上没有检索到相同的标头。有什么我想念的吗?

1 个答案:

答案 0 :(得分:0)

默认情况下,nginx不传递包含下划线的标题。

尝试:

underscores_in_headers on;

有关详细信息,请参阅此document