Nginx反向代理之proxy_set_header指令
生活随笔
收集整理的這篇文章主要介紹了
Nginx反向代理之proxy_set_header指令
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
proxy_set_header
該指令可以更改Nginx服務(wù)器接收到的客戶端請(qǐng)求的請(qǐng)求頭信息,然后將新的請(qǐng)求頭發(fā)送給代理的服務(wù)器
| 默認(rèn)值 | proxy_set_header Host $proxy_host;<br/>proxy_set_header Connection close; |
| 位置 | http、server、location |
需要注意的是,如果想要看到結(jié)果,必須在被代理的服務(wù)器上來(lái)獲取添加的頭信息。
被代理服務(wù)器: [192.168.200.146]
server {listen 8080;server_name localhost;default_type text/plain;return 200 $http_username; }代理服務(wù)器: [192.168.200.133]
server {listen 8080;server_name localhost;location /server {proxy_pass http://192.168.200.146:8080/;proxy_set_header username TOM;}}總結(jié)
以上是生活随笔為你收集整理的Nginx反向代理之proxy_set_header指令的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Nginx反向代理之proxy_pass
- 下一篇: Nginx反向代理的实战案例