Up until recently I have been using Squid as a caching web proxy. I’d heared that Apaches mod_proxy was capable of doing forward proxying, but I had no reason to change over, other than being able to remove an extra service from my box; I was already running both servers, but Apache was just serving websites.
I’ve been stuck using 3G for my Internet access for the past few days though, which is quite a bit slower than broadband, so it made me wonder if Squid was adding gzip compression to the responses. It wasn’t, and as far as I can see, there is no option to make it do so. So I figured I would try out using Apache instead. Here’s the vhost I came up with:
<VirtualHost *:3128> <Proxy *> Order Deny,Allow Deny from all Allow from 10.0.0.0/8 </Proxy> ProxyRequests On </VirtualHost>
My laptop appears on the 10.0.0.0/8 network when accessing the proxy over the Internet, because I’m using a VPN in the middle. I also have the following server wide configuration to add compression:
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so SetOutputFilter DEFLATE SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0 no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html Header append Vary User-Agent env=!dont-vary
Looking to hire somebody like me? I'm open to offers of full time employment and small contract jobs. Check out my hiring page. You can follow this Blog using RSS or Twitter. To read more, visit my blog index.