0

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
</Proxy>

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: http://myurl.com/myApp I can access ajax only using the same url. When I use www url prefix (http://www.myurl.com/myApp) 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,

Mateo

mateo
  • 15
  • 1
  • 5

2 Answers2

0

Do you have some .htaccess for redirection ?

ntrance
  • 382
  • 2
  • 2
0

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>
    ServerName example.com
    Redirect 301 / http://www.example.com/
</VirtualHost>

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

Quentin
  • 1,157
  • 6
  • 10
  • The "alternatively" suggestion helped. I didn't know that it will work like that. Thanks for your help!:-) – mateo Dec 01 '10 at 19:35