Apache as proxy

HTTP proxy (caching etc)

f apache.conf

Listen 8124
NameVirtualHost *:8124

<VirtualHost *:8124>
	ServerName proxy.foobar
	TransferLog /var/log/apache2/proxy-access.log
        ErrorLog /var/log/apache2/proxy-error.log

	<IfModule mod_rewrite.c>
	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]

	<IfModule mod_proxy.c>
		ProxyRequests On
		ProxyVia On
		# don't proxy for LAN addresses
		NoProxy localhost
		# default LAN domain for use where FQDNs aren't being used
		ProxyBadHeader Ignore
		ProxyStatus On
		ProxyPreserveHost On

		# limit connections to LAN clients
		<Proxy *>
			Order Deny,Allow
			Deny from all
			Allow from
			Allow from
			Allow from

apache/proxy.txt · Last modified: 2009/05/25 00:35 (external edit)
CC Attribution-Noncommercial-Share Alike 4.0 International
Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0 ipv6 ready