8

This seems straightforward, but I can't make it work.

I have a pretty trivial webserver that only needs to do two things:

  1. example.com/status.html returns a local file (this works)
  2. example.com/atom redirects the contents of the firewalled server running on the same machine on port 4000

This didn't work:

RewriteRule ^$ http://localhost:4000

That redirected traffic back to localhost:4000 from the requestor's point of view (ie, on the client's machine).

My limited understanding of VirtualHost indicates that that's for something like atom.example.com, not example.com/atom

I think I have to use ProxyReverse, but I can't find the right combination.

UPDATE: Trying the ProxyPass/ProxyReverse suggestion given by Shane Madden produces this in the error log file:

[Thu Mar 15 11:59:15 2012] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 127.0.0.1:4000 (localhost) failed
[Thu Mar 15 11:59:15 2012] [error] ap_proxy_connect_backend disabling worker for (localhost)
[Thu Mar 15 11:59:17 2012] [error] proxy: HTTP: disabled connection for (localhost)

(The local server is definitely running on 127.0.0.1:4000)

1 Answers1

10

Don't use mod_rewrite unless you have a reason to do so.

Try this (put it in the <VirtualHost> block):

ProxyPass /atom http://127.0.0.1:4000/atom
ProxyPassReverse /atom http://127.0.0.1:4000/atom
Shane Madden
  • 116,404
  • 13
  • 187
  • 256