Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a non-apache web server running on port 8000, but this cannot be accessed from behind corporate firewalls. So, I would like to use my apache 2 server as a proxy to this other web server. I've tried using:

RewriteEngine On
RewriteRule /.* http://buildbot.synergy-foss.org:8000/builders/ [PT]

... but this does not work; I get:

Bad Request

Your browser sent a request that this server could not understand.

However, it worked fine with [R].

Update:

Also, when using ProxyPass, I get this error:

Forbidden

You don't have permission to access / on this server.

share|improve this question

2 Answers 2

I wouldn't recommend using mod_rewrite for proxying unless you have a reason; mod_rewrite may be more powerful, but it sounds like you wouldn't need it.. For example, it sounds like you just want the following:

# Does't disable ProxyPass; but will disable everything you're not using
ProxyPass off
# Always setup a reverse proxy so that Apache can rewrite the URL
ProxyPass / http://buildbot.synergy-foss.org:8000/builders/
ProxyPassReverse / http://buildbot.synergy-foss.org:8000/builders/

Make sure you enable mod_proxy (documentation here) as well. Good luck!

share|improve this answer

You want the [P] flag, not [PT]. [PT] on a rewrite rule says 'pass through', allow processing by other handlers (Alias, Redirect etc).

You could also achieve the same results with mod_proxy, starting with something like:

ProxyPass / http://buildbot.synergy-foss.org:8000/builders/
share|improve this answer
    
If I use [P] I get the error: You don't have permission to access / on this server. and using ProxyPass gives a slightly different error. Are you absolutely sure both of those work? –  nbolton Sep 6 '10 at 9:40
    
By default, proxying is disallowed. Look at Basic Examples/Reverse Proxying in that linked URL to fix. –  crb Sep 6 '10 at 10:11
    
Hmm, ok, now I'm getting: [error] proxy: ap_get_scoreboard_lb(0) failed in child 29869 for worker proxy:forward –  nbolton Sep 6 '10 at 12:06
    
Have you restarted Apache, as opposed to just reloading config? –  crb Sep 6 '10 at 13:18

Your Answer

 
discard

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.