0

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?

user605331
  • 243
  • 3
  • 6

1 Answers1

0

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

André Schild
  • 258
  • 3
  • 9
  • I was kind of hoping for something simpler than Apache. If not though, it does look like it will do the job. – user605331 May 01 '13 at 17:41
  • 1
    You can do the same with Ngnix or Lighttpd, but it's more or less the same. You need a "real" http server with proxy capabilities, a simple port forwarding won't be enough since you wish to distribute based or a url pattern. – André Schild May 02 '13 at 05:31
  • 1
    I ended up using Lighttpd, which seems to work well and have a very simple config to get what I needed. The proxy sample from here seemed to be a good example to work from: http://ttux.net/post/tips-lighttpd-url-redirect-url-rewrite/ – user605331 May 02 '13 at 20:42