Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

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

  1. returns a local file (this works)
  2. 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, not

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 (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

share|improve this question
RHEL 6.2 VM btw. Apache 2.2.15 – Steve Bennett Mar 15 '12 at 0:58

1 Answer 1

up vote 2 down vote accepted

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

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

ProxyPass /atom
ProxyPassReverse /atom
share|improve this answer
At the moment I don't have a virtualhost block - will I need one? Or two? And if so, do they both start "VirtualHost *:80"? – Steve Bennett Mar 15 '12 at 0:48
Are you sure you don't have one? Most sets of default configuration files do define one; how'd you install Apache? But - if you do not have one, then there's no need to add one - just add these directives to the server context. – Shane Madden Mar 15 '12 at 0:51
Ok that didn't quite work: "service temporarily unavailable" for /atom (/blah returns 404 so it's doing something...) – Steve Bennett Mar 15 '12 at 0:54
Shane: that section of httpd.conf only contains the commented out examples – Steve Bennett Mar 15 '12 at 0:56
Finally works. I needed to change a security setting: sudo /usr/sbin/setsebool -P httpd_can_network_connect 1 – Steve Bennett Mar 15 '12 at 1:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.