Super User is a question and answer site for computer enthusiasts and power users. 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 a.example.com and b.example.com - serving a ruby on rails app.

On my virtualhost config file I have this rule:

rewriteEngine on
rewriteRule proxy/(.+)$ http://news.example.com/$1 [P]

The idea is that I can do http://a.example.com/proxy/news/a and get the contents of http://news.example.com/news/a, 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
up vote 0 down vote accepted

I've just realized that this was the wrong place to ask this kind of question.

I'm moving this question to serverfault, and will mark this answer as "correct" as soon as I'm allowed. If you were going to answer this question, please do it here:

http://serverfault.com/questions/364471/apache-mod-rewrite-mod-proxy-working-in-staging-not-working-in-production

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .