在该配置中,因为没有显示地设置proxy_set_header Host $host;,所以导致传递给后端服务器的请求中没有包含Host头部。默认情况下,当使用proxy_pass指令时,Nginx会自动从客户端请求中复制Host头部,并将其传递给后端服务器。但是,如果设置了proxy_set_header Host并且没有设置值,那么Nginx会将空字符串传递给后端服务器,从而导致Host丢失。要解决此问题,可以将proxy_set_header Host $host;添加到该location配置中,确保Host头部正确传递给后端服务器。

nginx配置文件中某个location配置如下:location proxy_http_version 11; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_pass http12348080;当流量

原文地址: https://www.cveoy.top/t/topic/imU4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录