[CentOS] redirecting when behind a firewall

Fri Jul 11 07:46:45 UTC 2008
Mikael Fridh <mikael.fridh at its.uu.se>

On Thu, Jul 10, 2008 at 12:29:18PM -0700, bruce wrote:
> 
> So i don't have the ability to do something like "forward foo.gotdns.com to
> machine1, and forward foo2.gotdns.com to machine2" which is exactly what i'm
> trying to accomplish!!
> 


You wrote a really long mail so sorry if I missed some of your intentions but
here's some pseudo-code showing an example ...



DNS
===
foo.example.com. IN A 123.123.123.123
foo1.example.com. IN CNAME foo.gotdns.com
foo2.example.com. IN CNAME foo.gotdns.com


ROUTER
======
redirects all WAN traffic to internal LAN server:
WAN: 123.123.123.123 => LAN: 192.168.0.10



FRONT-END APACHE (192.168.0.10)
================
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName foo1.example.com
  ProxyRequests Off
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass		/ http://internal1.foo.example.com/
  ProxyPassReverse	/ http://internal1.foo.example.com/
</VirtualHost>

<VirtualHost *:80>
  ServerName foo2.example.com
  ProxyRequests Off
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
  ProxyPass		/ http://internal2.foo.example.com/
  ProxyPassReverse	/ http://internal2.foo.example.com/
</VirtualHost>


Now all you need is to set up internal[12].foo.example.com as either vhosts or
on physical web servers.

That's one possible solution. Others might be more complex load balancer
setups.

--
Fridh