pengkobe / reading-notes

:stars: to record daily reading notes. I build an issue blog to record daily FE study notes. suggestion and comments are welcomed.
https://github.com/pengkobe/reading-notes/issues
MIT License
13 stars 1 forks source link

X-Forwarded-For #422

Open pengkobe opened 6 years ago

pengkobe commented 6 years ago

其能让 Web 服务器获取到真实的客户端 IP

这个协议头的格式:

X-Forwarded-For: client, proxy1, proxy2

nginx 反向代理设置一般为

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

注意点

参考

https://www.cnblogs.com/huaxingtianxia/p/6369089.html