New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE]开启CDN后网站日志只显示CDN回源IP #4971
Labels
Comments
能否贴一下 宝塔 的设置页面 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1Panel 版本
v1.10.7-lts
请描述您的需求或者改进建议
如题,开启CDN以后网站日志就变成下面这样的内容:
163.181.146.187 - - [10/May/2024:14:20:12 +0000] "GET /admin/?m=admin HTTP/1.1" 200 1895 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
前面的163.181.146.187就是阿里云CDN的回源IP,而并非访问用户IP。
请描述你建议的实现方案
真实的用户IP都在这个HTTP头中:
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
1Panel可以先获取一下存不存在这个HTTP头信息,如果存在则在网站日志中显示real ip。
如果HTTP头中不存在上面那些参数,则就按照标准信息返回。
就类似BT一样。
附加信息
No response
The text was updated successfully, but these errors were encountered: