[英]X-Forwarded-For not working in apache web server
美好的一天,
以下是我的Web項目的架構圖。
Internet --> F5 Load balancer --> Apache web server --> web application
我試圖使Apache Web服務器從負載平衡器接收來自Internet的用戶ip。
但是,我發現Apache Web Server
正在從F5 Load balancer
接收F5 ip
,而不是從Internet接收用戶ip。
因此,我從Web服務器打開httpd.conf
並在其中配置X-Forwarded-For
設置,以下是我在httpd.conf
添加的值:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
# The following line is added by me
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
# I commented this following line
#CustomLog logs/access_log combined
# The following 3 lines is added by me
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
CustomLog "logs/access_log" combined env=!forwarded
CustomLog "logs/access_log" proxy env=forwarded
我重新啟動apache
服務器,但結果仍然相同。 我可以知道我為配置設置的任何錯誤嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.