套 cf cdn,怎么保证 CF-Connecting-IP 不被伪造?
-
我是要获取用户的真实 IP
127.0.0.1:80 <- frpc <- frps <- cf cdn <- 访问者如果我直接访问 frps,伪造 CF-Connecting-IP
curl -v http://frp-cup.com/ \ -H "Host: 114514.org" \ -H "CF-Connecting-IP: 1.2.3.4"set_real_ip_from 127.0.0.1nginx 应该怎么配置保证CF-Connecting-IP 不被伪造 ,本人小白求救。
-
nginx.conf 配置
proxy_set_header X-Real-IP $proxy_protocol_addr; proxy_set_header X-Forwarded-For $proxy_protocol_addr;站点配置
listen 443 ssl http2 proxy_protocol; server_name example.com; index index.php index.html index.htm default.php default.htm default.html; real_ip_recursive on; # 递归处理 PROXY 协议中的 IP 地址 set_real_ip_from 127.0.0.1; # 这里的127.0.0.1表示可信的代理服务器 IP 地址 set_real_ip_from 10.10.1.1/24; real_ip_header proxy_protocol; # 启用 PROXY 协议支持