Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set up a redirect in my Apache virtual host serving several subdomains - call them and - serving a ruby on rails app.

On my virtualhost config file I have this rule:

rewriteEngine on
rewriteRule proxy/(.+)$$1 [P]

The idea is that I can do and get the contents of, but within the same subdomain, so ajax doesn't think my ajax requests are cross-domain - more info on this SO question.

The problem is that while it works just fine in my staging environment, it does not in production!

Both servers are Ubuntu server 10.04 . Apache came from the standard ubuntu repos, using apt-get install.

I have made a diff of the whole /etc/apache2/ dir and the only difference is the server name.

If I change the last option to [L], I get a redirect, so this makes me think that mod_rewrite is working. It just doesn't talk with mod_proxy.

By looking at the logs (/var/log/apache2 and the rails log), it seems like the rewrite rule in production is simply being ignored - the logs are exactly the same as if it wasn't there.

How can I debug this? Can I force Apache to give me more information about why this particular rule isn't enforced when I access /proxy?

share|improve this question
What does your RewriteLog show you? – larsks Feb 28 '12 at 14:09
Is mod_proxy loaded? It's needed for the [P] flag. – Shane Madden Feb 28 '12 at 16:26
@larks: I didn't know about that log! I'm browsing that. – egarcia Feb 28 '12 at 16:50
@ShaneMadden yes, mod_proxy is loaded. – egarcia Feb 28 '12 at 16:50
up vote 2 down vote accepted

After browsing RewriteLog as larsks suggested, we have realized that Apache was indeed doing the redirects - the problem was somewhere else.

In fact, it was the module we where using to handle ruby - Phusion Passenger.

We had one of those "OMG the server is down!" moments and we tried setting up the PassengerHighPerformance variable to on.

Unfortunately, this setting basically means "ignore mod_rewrite" :)

Now we have tuned it out a bit - it's on in all the locations, except when they begin by /proxy:

PassengerHighPerformance On
<location /proxy>
  PassengerHighPerformance Off

Once we added that configuration option to our virtualhost config file, things started working again!

If you come here via google and found this useful, please upvote Larsks' comment on the OP. His comment was what put us on the right track.

share|improve this answer

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.