[英]How does nginx forward a header with a $ sign
A Http Request has a header : $name ,access nginx forward ,the header will lose ,but I need the header:$name,how can I config the nginx?一个 Http 请求有一个标头: $name ,向前访问 nginx,标头会丢失,但是我需要标头:$name,我该如何配置 nginx?
example:例子:
location /api/ {
proxy_pass http://127.0.0.1:8081/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header $name $http_$name;
}
Escape dollar sign by creating a variable with it:通过创建一个变量来转义美元符号:
http {
geo $dollar {
default "$";
}
server {
...
location /api/ {
proxy_pass http://127.0.0.1:8081/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header ${dollar}name $http_$name;
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.