title: reverse proxy+dispatcher - what is the easiest way
body: <p>I am looking for a solution which would redirect the externally facing <code>http://mycompany.com/external/*</code> to be redirected/proxied to <code>http://internal-host:1234/internal/*</code>
  (the asterisk is used as a wildcard)</p>
  
  <p>OK, I guess the sentence above is not enough, so here are the details:</p>
  
  <p>In my intranet I have several servers, (names, addresses, ports, and context paths are obviously made-up for the sake of simplicity):</p>
  
  <ol>
  <li>HRServer running at address <code>10.10.10.10:1010/hr</code></li>
  <li>MailServer running at address <code>20.20.20.20:2020/mail</code></li>
  </ol>
  
  <p>My system is accessible from internet only from ip 78.78.78.78, and the constraint here is that I can use only one port (e.g. 8080). In other words - whatever the solution of my problem is - the external address should start with <code>78.78.78.78:8080</code></p>
  
  <p>What I need to do is to expose both HR and Mail services though this port.
  The first thing which came to my mind was to write two simple portlets (or an HTML with two frames) and to embed them in a simple web page at 78.78.78.78:8080/
  But obviously this will not work, as the portlets will redirect the browser to e.g 10.10.10.10:1010/hr which is not visible from the internet.
  So my next thought was - OK, lets find a reverse proxy which has dispatching capabilities. Then I can make</p>
  
  <ul>
  <li><code>78.78.78.78:8080/hr</code> to "redirect" to the internal <code>10.10.10.10:1010/hr</code></li>
  <li><code>78.78.78.78:8080/mail</code> to "redirect" to the internal <code>20.20.20.20:2020/mail</code></li>
  </ul>
  
  <p>I'd also expect that if let's say the mail server unread messages are seen on <code>20.20.20.20:2020/mail/unread</code> the unread messages to be also accessible from internet.
  Roughly speaking - I'd expect </p>
  
  <ul>
  <li><code>78.78.78.78:8080/mail/</code>* to redirect to the internal <code>20.20.20.20:2020/mail/</code>*   (the asterisk is used as a wildcard)</li>
  </ul>
  
  <p>I really feel I am missing the obvious here, but honestly - I've spent quite a while in researching several proxies and I did not find the answer. I might be looking for the wrong words or something, but I could not find reverse proxy which can be configured to dispatch external path to different internal paths.</p>
  
  <p>So please - if the answer is e.g. the Apache mod_proxy - please give me a hint about the parameter names that I should be looking for.
  Lastly - I am going to run thin in a FreeBSD OS, but this is not a strong requirement (other *nix OSes are also fine)
  Thanks!</p>