反向代理失败?nginx配置proxy_set_header Host $host的作用
2020-03-29 12:34
1761 查看
nginx 配置了反向代理后,接口访问一直400
proxy_pass http://imglib.xxx.xxxx.com;
后来一查发现要带上 proxy_set_header Host imglib.xxx.xxxx.com
proxy_set_header Host $host这一行的作用是把原http请求的Header中的Host字段也放到转发的请求里。
如果不加这一行的话,nginx转发的请求header里就不会有Host字段,而服务器是靠这个Host值来区分你请求的是哪个域名的资源的。
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- nginx中proxy_set_header Host $host的作用
- 【转】nginx中proxy_set_header Host $host的作用
- 【Nginx的坑】nginx反向代理proxy_set_header自定义header头无效的问题
- nginx中proxy_set_header Host $host;的作用
- nginx中proxy_set_header Host $host的作用
- nginx中proxy_set_header Host $host的作用
- nginx反向代理proxy_set_header自定义header头无效
- nginx反向代理proxy_set_header自定义header头无效的问题
- nginx反向代理proxy_pass不配置URI引起的思考
- Nginx不同域名反向代理到另一台服务器 proxy_pass和$host
- 在Nginx服务器中配置mod_proxy反向代理的方法
- Nginx反向代理proxy_store配置
- nginx 反向代理 ,配置 含自定义header 和php fastcgi
- NGINX 配置的一个坑,proxy_set_header 中携带下划线
- nginx反向代理配置(nginx.conf+proxy_set_header)
- apache 反向代理的ProxyPreserveHost 配置
- nginx中proxy_set_header 的作用
- Nginx服务器安装,高性能的HTTP、TCP、反向代理、负载均衡等服务和配置
- nginx搭建反向代理配置并测试
- Nginx配置反向代理