[Scottish] mod_proxy with a dash of mod_rewrite

Colin McKinnon colin.mckinnon at ntlworld.com
Mon Jan 15 21:51:52 GMT 2007

On Sunday 14 January 2007 11:11, Gary Hendricks wrote:
> I have been struggling a wee while with something.
> Here is the scenario:
>   ---|FW|---|web1|---|web2|
> I have a normal webserver on web1 that serves general pages.
> The web2 is an internal webserver that serves all kinds of media with
> Jinzora.
> The problem is that i want to address both of these servers via the net
> on the same port (80)
> eg:
> o Firewall accepts the connect and passes it on to web1
> o web1 checks the servername and then forwards the connection onwards if
> it is for web2.

So far this is fairly straightforward.

> Problems:
> web2 has complex urls ie http://web2/index.php?3d%2FC4sbo2w%
> web1 also has complex urls with /index.php

> <VirtualHost *>
>   ServerName web2
>    ProxyRequests On
>    ProxyPass         /media/ http://web2/
> </VirtualHost>

I don't understand what you are asking for that wouldn't be satisifed by the 

I suspect that its possible just with apache configs, but I'm hesitant to 
provide an example when I don't really understand what your asking. Can you 
give examples of URLs and the files they reference on each webserver along 
with the network architecture (e.g. is there NAT on FW?).

Since you asked for alternative approaches:

Try using a smarter switch in front of the webservers e.g.


Of course Squid need not be on a seperate box.

Alternately write a wee wrapper on Web1 to redirect requests to Web2 (about 10 
lines of PHP if you're pedantic) listening on a different port (or 
implementing port mirroring with iptables)  but sharing the same external 
address then hang it either on a specific URL or the 404 handler:

	if (strstr($_SERVER['SERVER_PROTCOL'],'1.0')) {
		header("Location: $otherURL", true, 302);
	} else {
		header("Location: $otherURL", true, 307);



More information about the Scottish mailing list