[Cialug] HTTP forwarding/proxying-ish something

Zachary Kotlarek zach at kotlarek.com
Mon Jun 30 18:22:17 CDT 2008


On Jun 28, 2008, at 3:14 PM, Colin Burnett wrote:

> h one public IP on the DSL side and a
> 192.168.0.x private network on the other
> * Modem port forwards from public static IP port 80 to a private LAN
> machine (A) port 80 (strictly a TCP port forwarder)
> * A:80 is running Apache 2.2.9
> * B:80 is running another HTTP server (which server is entirely
> irrelevant, but it is intentionally not apache)
> * foo.com and bar.com resolve to the one-and-only public IP
>
> I want A:80 to serve foo.com but I want B:80 to server bar.com (based
> entirely on HTTP 1.1 host header), which necessitates Apache on A:80
> to understand bar.com and be able to forward requests to B:80.  My
> requirement is both foo.com and bar.com resolve to the same public
> static IP since I don't want to pay for more than one :)
>
> Will Apache let me proxy in this manner?  If A:80 has to run something
> else and I move that apache to another port...so be it.


mod_proxy makes it pretty easy:
	ProxyRequests off
	ProxyPass /local/URI http://B:80/remote/URI
	ProxyReversePass /local/URI http://B:80/remote/URI

If you want to use hostnames instead of paths to distinguish the local  
and proxied system just slap the proxy configuration into a vhost  
section.

mod_rewrite also makes the P target available to make proxy calls in  
more interesting ways, should you need something more complicated than  
a flat, whole-site mirror.

	Zach

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1682 bytes
Desc: not available
Url : http://cialug.org/pipermail/cialug/attachments/20080630/3a41bf33/smime.bin


More information about the Cialug mailing list