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

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'm currently facing interesting problem which I cannot resolve. I have an Apache2 as a proxy to Tomcat. The proxy configuration looks like:

<Proxy *>
  Order deny,allow
  Allow from all

ProxyRequests       Off
ProxyPreserveHost   On
ProxyPass           /myApp       http://localhost:8080/myApp
ProxyPassReverse    /myApp       http://localhost:8080/myApp

Everything works fine, the problem come with AJAX within my application. When I go to myApp url: I can access ajax only using the same url. When I use www url prefix ( for AJAX the ajax content is not loaded (apache logs HTTP 302). This also doesn't work vice versa. I'm pretty sure that I can correct it in Apache, but I don't know how. Do you have any suggestion?

Thanks for any help,


share|improve this question
up vote 0 down vote accepted

Pick one host name to be canonical and redirect to it from the other.

e.g. (If I'm remembering my Apache syntax right)

<VirtualHost *:80>
    Redirect 301 /

Alternatively (or additionally). Use root relative URIs (i.e. those which start with /foo instead of so that requests stay on the same host.

share|improve this answer
The "alternatively" suggestion helped. I didn't know that it will work like that. Thanks for your help!:-) – mateo Dec 1 '10 at 19:35

Do you have some .htaccess for redirection ?

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.