若要安裝此 Apache Proxy , 可以用下列指令先安裝
sudo apt-get install apache2
sudo a2enmod proxy
sudo a2enmod proxy_http
然後再指定 module 的內容如下
ProxyPass /hudson http://localhost:8081/hudson但此時內部 server 透過 api 拿到的 ip 都會是此 proxy server 的 IP 。若要拿到 real IP 則需要透過 http header 拿,這些 header 如下
ProxyPassReverse /hudson http://localhost:8081/hudson
ProxyRequests Off
# Local reverse proxy authorization override
# Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
Order deny,allow
Allow from all
X-Forwarded-For
The IP address of the client.
X-Forwarded-Host
The original host requested by the client in the Host HTTP request header.
X-Forwarded-Server
The hostname of the proxy server.
不過這個要 server 端的 code 必須偵測並加上這些 API 才能取得