Nginx proxy_set_header中$proxy_host,$host,$http_host的区别
2017-05-18 18:55
681 查看
在使用Nginx做反向代理的时候,proxy_set_header功能可以设置反向代理后的http header中的host,
那么常用的几个设置中$proxy_host, $host,$http_host又都表示什么意思呢?
Nginx的官网文档中说下面这两条是做反代时默认的,所以$proxy_host 自然是 proxy_pass后面跟着的host了
如果客户端发过来的请求的header中有’HOST’这个字段时,
$http_host和$host都是原始的’HOST’字段
比如请求的时候HOST的值是www.csdn.net 那么反代后还是www.csdn.net
如果客户端发过来的请求的header中没有有’HOST’这个字段时,
建议使用$host,这表示请求中的server name。
那么常用的几个设置中$proxy_host, $host,$http_host又都表示什么意思呢?
Nginx的官网文档中说下面这两条是做反代时默认的,所以$proxy_host 自然是 proxy_pass后面跟着的host了
proxy_set_header Host $proxy_host; proxy_set_header Connection close;
如果客户端发过来的请求的header中有’HOST’这个字段时,
$http_host和$host都是原始的’HOST’字段
比如请求的时候HOST的值是www.csdn.net 那么反代后还是www.csdn.net
如果客户端发过来的请求的header中没有有’HOST’这个字段时,
建议使用$host,这表示请求中的server name。
相关文章推荐
- nigix proxy_set_header Host $host:$server_port 与 $host:proxy_port 区别
- Nginx proxy_set_header设置Host为$proxy_host,$host与$local_host的区别
- proxy_set_header设置Host为$proxy_host,$host与$local_host的区别
- nginx中proxy_set_header Host $host的作用
- nginx 之$proxy_host|$host|$http_host区别
- nginx-upstream-keepalive;accept_mutex-proxy_http_version-1.1-proxy_set_header-connection
- nginx中proxy_set_header Host $host的作用
- nginx中proxy_set_header Host $host的作用
- [转]php curl 设置host curl_setopt CURLOPT_HTTPHEADER 指定host
- nginx中proxy_set_header Host $host;的作用
- 【转】nginx中proxy_set_header Host $host的作用
- nginx proxy_set_header Host $http_host 配置
- PHP中 HTTP_HOST 和 SERVER_NAME 的区别 MiMi Posted on 2010.07.02 10:25 // 2 Comments
- HTTP_HOST 和 SERVER_NAME 的区别
- nginx proxy_set_header设置、自定义header
- node.js中的http.response.setHeader方法使用说明
- PHP中 HTTP_HOST 和 SERVER_NAME 的区别
- HTTP_HOST 和 SERVER_NAME 的区别
- nginx中proxy_set_header 的作用
- Nginx proxy_set_header 理解