Linux – Forwarding url requests to different ports

linuxport-forwardingUbuntuurl-routing

For development I run a few different servers (multiple instances of Tomcat and nodejs) to simulate some applications that work together. Each one runs on a different port and responds to different urls. I'd like to put a simple service in front of them all that would forward the requests to them based on url pattern.

Here's an example:

This would go to a local Tomcat instance running on port 8080:

http://localhost:8888/search/query=something

This would go to a local nodejs instance running on port 8081:

http://localhost:8888/site/index.html

I don't need any fancy features, I just want to be able to have a browser access a single host/port to get to all these other servers. I imagine some simple program with a conf file where I could put in url expressions and a host/port to forward to. What's the simplest thing I can install & configure (on Linux) to do this?

Best Answer

A way to do it is putting a apache with mod_proxy in front of the servers. You could then forward all /search/* urls to tomcat and all /site/* to nodejs

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Related Topic