Board logo

Reverse proxy configuration
Slimy38 - 14/7/14 at 01:29 PM

Anyone know anything about configuring a reverse proxy? I want to set up a website that is basically a collection of third level domains under a single URL, but I want to have a single box set up as public facing, that then each third level domains routes the traffic to a different IP address and port in my local network.

So for example;

www.1.slimy.co.uk would route to http://192.168.0.1:80
www.2.slimy.co.uk would route to http://192.168.0.5:8080
www.3.slimy.co.uk would route to http://192.168.0.10:8888

with all domains routing to a single public facing address, and assume all HTTP traffic (despite the port changes).

Apologies if what I'm thinking about isn't possible, if I have to do it another way then I'd appreciate any input.

[Edited on 14/7/14 by Slimy38]


jeffw - 14/7/14 at 01:39 PM

It can certainly be done. Most forward proxies will do it in reverse like this.

What are you going to use?


jeffw - 14/7/14 at 01:42 PM

www.1.slimy.co.uk would route to http://192.168.0.1:80
www.2.slimy.co.uk would route to http://192.168.0.5:8080
www.3.slimy.co.uk would route to http://192.168.0.10:8888

Not sure why you are changing IP and port numbers for the inside addresses. One or the other.

You could do Port Address Translation or do Reverse Proxy


Slimy38 - 14/7/14 at 01:55 PM

quote:
Originally posted by jeffw
www.1.slimy.co.uk would route to http://192.168.0.1:80
www.2.slimy.co.uk would route to http://192.168.0.5:8080
www.3.slimy.co.uk would route to http://192.168.0.10:8888

Not sure why you are changing IP and port numbers for the inside addresses. One or the other.

You could do Port Address Translation or do Reverse Proxy


this is only a sample of the routes, some boxes share tasks so I could also have;

www.4.slimy.co.uk would route to http://192.168.0.10:6666

They're hosting different software applications that are all web based, all have configurable ports but not all can live on the same box. I suspect in reality I'll use up port 80 on all IP addresses first, then maybe 81, 82 etc depending on how many I need on each box.

As for software, I've just been looking at the mod_proxy options with Apache.

Thanks for the quick response.


GreigM - 14/7/14 at 02:36 PM

was just going to post that Apache and mod_proxy is what you're looking for - once you get your head round the manual its really quite simple to use


jeffw - 14/7/14 at 02:51 PM

It is just a matter of tying the listener Ports/addresses to the URLs, easy enough in F5 or Bluecoat, not done it in Apache for many years.


ironside - 16/7/14 at 05:26 PM

Apache/mod_proxy will do this for you. You'll need to enable name-based virtual hosting with:

code:
NameVirtualHost *:80


Then create a VirtualHost entry for each of site names such as:

code:

<VirtualHost *:80>
ServerName www.1.slimy.co.uk
ProxyPass / http://192.168.0.1/
ProxyPassReverse / http://192.168.0.1/

CustomLog logs/www.1.slimy.co.uk-access.log combined
ErrorLog logs/www.1.slimy.co.uk-error.log
</VirtualHost>

<VirtualHost *:80>
ServerName www.2.slimy.co.uk
ProxyPass / http://192.168.0.5:8080/
ProxyPassReverse / http://192.168.0.5:8080/

CustomLog logs/www.2.slimy.co.uk-access.log combined
ErrorLog logs/www.2.slimy.co.uk-error.log
</VirtualHost>



And so on . . .

[Edited on 16/7/14 by ironside]


Slimy38 - 16/7/14 at 06:01 PM

Awesome! Now all I need to do is figure out how to do the same with UDP... turns out one of the apps uses UDP rather than TCP.


ironside - 16/7/14 at 06:11 PM

Mind that will only work for HTTP (and HTTPS), not any TCP application.
I assume it's not HTTP over UDP - is that even a thing?

[Edited on 16/7/14 by ironside]


jeffw - 16/7/14 at 09:36 PM

You are going to have to do NATing and not reverse proxy.