【发布时间】:2018-06-27 11:57:26
【问题描述】:
NGINX 新手。 目前正在使用 Nginx 运行本地反向代理。
只是想知道如何将请求标头中的引用者从 http://localhost:8080 更改为不同的 server_name,例如 me.example.com
很难找到有关此主题的明确文档。 已尝试使用以下方法设置此值:
proxy_set_header Referer "me.example.com";
似乎什么也没做。
非常感谢您对此的任何帮助。
server {
listen 8080;
server_name localhost;
# test APi
location /test/api {
# Edit this line only:
proxy_pass https://test.com/test/api;
proxy_set_header Host $http_host;
break;
}
location / {
proxy_pass http://localhost:4567;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Referer "me.example.com";
}
}
【问题讨论】:
-
你能发布你的nginx配置吗?
-
添加了 nginx 配置