====== Apache as proxy ====== ===== HTTP proxy (caching etc) ===== Listen 8124 NameVirtualHost *:8124 ServerName proxy.foobar TransferLog /var/log/apache2/proxy-access.log ErrorLog /var/log/apache2/proxy-error.log RewriteEngine On RewriteLog /var/log/apache2/rewrite.log RewriteLogLevel 9 # Only rewrite requests that don't already have a Via: header # If there is a possibility of this proxy being in a chain # then you'll have to test the Via hostname value as well using something like this RewriteCond %{HTTP:Via} !.*proxy.foobar.* RewriteCond %{HTTP:Via} ^$ # Alter the GET /... to GET http://host/... so it is treated as # a proxy request, and then forward it to mod_proxy immediately RewriteRule ^/(.*) http://%{HTTP_HOST}$1 [P] #RewriteRule (.*) [P] ProxyRequests On ProxyVia On # don't proxy for LAN addresses NoProxy localhost 10.0.0.0/8 127.0.0.0/8 192.168.0.0/16 # default LAN domain for use where FQDNs aren't being used ProxyBadHeader Ignore ProxyStatus On ProxyPreserveHost On # limit connections to LAN clients Order Deny,Allow Deny from all Allow from 10.0.0.0/8 Allow from 127.0.0.0/8 Allow from 192.168.0.0/16