我正在尝试使用 Thin应用服务器,有一个问题。
当 nginx proxies使用 proxy_pass http://my_app_upstream;
对 Thin(或 Unicorn)的请求 应用程序接收 nginx 发送的修改后的 URL(http://my_app_upstream
)。
我想要的是不加修改地传递原始 URL 和来自客户端的原始请求,因为应用严重依赖它。
nginx' doc说:
If it is necessary to transmit URI in the unprocessed form then directive proxy_pass should be used without URI part.
但我不明白如何配置它,因为相关示例实际上使用的是 URI:
location /some/path/ {
proxy_pass http://127.0.0.1;
}
那么你能帮我弄清楚如何保留来自客户端的原始请求 URL吗?
最佳答案
我认为 proxy_set_header
指令可以帮助:
location / {
proxy_pass http://my_app_upstream;
proxy_set_header Host $host;
# ...
}
关于ruby - 如何使用 nginx proxy_pass 保留请求 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5834025/