Reverse Proxy 的設定 /etc/httpd/conf/httpd.conf
<virtualhost *:80>
ProxyPass /aa http://192.168.1.1
ProxyPassReverse /aa http://192.168.1.1
</virtualhost>
Web(192.168.1.1 (apache)) 修改 Log設定 /etc/httpd/conf/httpd.conf 加入
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
CustomLog "logs/access_log" combined env=!forwarded
CustomLog "logs/access_log" proxy env=forwarded
限制
Web 中若有同一層目錄會有無法 PassReverse 情況
上例設定中若 url http://web/b <===> http://reverse-proxy/aa/b <= 失效
沒有留言:
張貼留言