Register now and start sharing your code snippets.
-->
Configuring Apache to be a forward proxy
Apache posted about 1 month ago by christian
This configuration makes Apache act as an HTTP proxy:
1 <VirtualHost *:8080> 2 ProxyRequests On 3 ProxyVia On 4 #ProxyRemote * http://...:8080 Uncomment to route requests through another proxy 5 <Proxy *> 6 Order deny,allow 7 Deny from all 8 Allow from all # Not a good idea, set to allowed IP ranges 9 </Proxy> 10 11 CacheRoot "/tmp" 12 CacheMaxExpire 24 13 CacheLastModifiedFactor 0.1 14 CacheDefaultExpire 1 15 16 ServerName my-proxy 17 18 ErrorLog "/var/log/apache2/proxy-error.log" 19 CustomLog "/var/log/apache2/proxy-access.log" common 20 </VirtualHost>
Also read this.
Tips
You can use mod_rewrite to rewrite requests. To rewrite root (/) to /temporary_outage you could use the following rewrite:
1 RewriteCond %{HTTP_HOST} ^(www\.)?xxx\.com 2 RewriteRule /$ http://%{HTTP_HOST}/temporary_outage/ [P,L]