惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

嵌入式工程猫的博客

使用树莓派 4 和 Moonlight 串流游戏的实践 维护 Nginx 时,什么时候应该用 reload,什么时候应该用 restart? 批量修改 qbittorrent-nox 内种子的 tracker 地址 把 vim 的缩进设为 4 个字符,并且 tab 自动转空格 不用 snap,在 Ubuntu 上安装 certbot 在 Ubuntu 中启用 swap - 嵌入式工程猫的博客 在 Linux 中显示所有正在监听的 TCP 端口 再一次理解 C++ 中的 extern "C" 航模舵机控制及其 PWM 调制的进一步理解 - 嵌入式工程猫的博客 如何自签名带 SAN 字段的 SSL/TLS 证书 深入理解以太网网线原理 - 嵌入式工程猫的博客 FreeBSD vs Linux:哪个开源操作系统更强大 - 嵌入式工程猫的博客 如何在 Markdown 中修改字体颜色 - 嵌入式工程猫的博客 如何在 ESP8266 上选用合适的引脚 - 嵌入式工程猫的博客 如何 DIY 一个苏康码与行程码“双码合一”的健康码 APP - 嵌入式工程猫的博客 我两周就写了三行代码 - ARM Cortex A9 中断与浮点数运算、FPU 问题 随便聊聊最近在本站折腾的那些东西 - 嵌入式工程猫的博客 分享一下我的家庭网络布局 - 嵌入式工程猫的博客 Mapuino - 一个硬件极客风的 WEB 访客地图显示摆件 Topuino - 你愿意在办公桌上放一个监控服务器的小摆件吗? - 嵌入式工程猫的博客
让 Nginx 反向代理的程序获取客户端真实 IP - 嵌入式工程猫的博客
2024-05-07 · via 嵌入式工程猫的博客

Nginx 配置添加以下内容:

1
2
3
4
5
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

其含义就是在反代时,在客户端发起的请求报文上添加 X-Real-IPX-Forwarded-For 两个 HTTP 头。X-Real-IP 表示表观客户端地址,X-Forwarded-For,顾名思义,就是“为谁代理”的意思,这个可以用来嵌套式传输客户端真实地址。

被代理的服务,只要能正确解析这两个头,就能获得客户端真实地址。