为什么proxy_set_header主机$ host;不再在nginx 1.8.0中工作? [英] Why is proxy_set_header Host $host; no longer working in nginx 1.8.0?

查看:87
本文介绍了为什么proxy_set_header主机$ host;不再在nginx 1.8.0中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用proxy_set_header Host $host;将主机标头设置为原始请求主机.在nginx 1.4.1中,这工作正常.现在,升级到1.8.0后,我得到的是本地IP,而不是浏览器传递的主机.

I used proxy_set_header Host $host; to set the host header to the original request host. In nginx 1.4.1 this was working fine. Now after upgrading to 1.8.0, I'm getting the local IP instead of the host passed by the browser.

为什么会发生这种情况以及如何解决?

Why did this happen and how do I fix it?

推荐答案

使用proxy_set_header Host $http_host.

如果proxy_set_header Host $host;不再起作用,则$host的含义/行为可能已更改. $http_host只是传递浏览器发送的内容.

If proxy_set_header Host $host; no longer works, perhaps the meaning/ behavior of $host changed. $http_host just passes along what was sent by the browser.

这篇关于为什么proxy_set_header主机$ host;不再在nginx 1.8.0中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆