1.网站同时使用代理服务器与 Cloudflare
2.所以在上述情况下X-Forwarded-For会返回多个ip(先是代理服务器记录了Cloudflare访问源站的IP即CDN-IP,然后Cloudflare记录了用户真实IP即图中ipv6地址):如下图OpenResty日志
The general format of the field is:
X-Forwarded-For: client, proxy1, proxy2[3]
where the value is a comma+space separated list of IP addresses, the left-most being the original client, and each successive proxy that passed the request adding the IP address where it received the request from. In this example, the request passed through proxy1, proxy2, and then proxy3 (not shown in the header). proxy3 appears as remote address of the request.
所以当前情况下真实IP应该为上述图中的ipv6地址,即经过代理服务器,会出现上述情况,取第一个才是真实IP
4.使用1panel的WAF或网站监控功能,记录有下图日志(全部为CDN-IP)
因为我没有条件测试纯ipv4情况,而我的家庭带宽默认ipv6优先,所以出现这种情况我不知是1panel在多ip的情况下获取了错误的真实ip地址或者1panel没有对ipv6进行适配?