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

I have apache2 exposing a jboss through mod_proxy_ajp on / and serving some static content with

ProxyPass /static !
ProxyPass / ajp://localhost:8009/

in proxy_ajp.conf. I need to redirect all the traffic on www.example.com to example.com and it works for all the static resources in /static but if I retrieve www.example.com/hello the url is not rewritten.

My Virtual Host config is the following

<VirtualHost *:80>
        ServerName www.example.com
        RedirectMatch 301 (.*) http://example.com$1
</VirtualHost>

<VirtualHost *:80>
        ServerName example.com
</VirtualHost>

What is wrong? I think that proxy_ajp is catching the request before is pass through apache and the url is redirected.

share|improve this question
    
Did the answer given by @H.-Dirk Schmitt work? I am looking for the same answer. If so give it a check so I and others can know. Thanks. –  BillR Sep 20 '12 at 18:34

1 Answer 1

I think that you have forgotten the ProxyPassReverse statement. It has the same parameters as the ProxyPass statement.

Try:

 ProxyPass        /static !
 ProxyPass        / ajp://localhost:8009/
 ProxyPassReverse / ajp://localhost:8009/
share|improve this answer

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.