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

This is the scenario:

I have an Apache server set as a reverse proxy to 2 Apache Tomcat servers. The reverse proxy has configured Virtual Hosts as follow:

<VirtualHost 168.12.12.12:80>
ProxyPass /Site1/TomcatApplet http://1.1.1.1/Site1/TomcatApplet
ProxyPassReverse /Site1/TomcatApplet http://1.1.1.1/Site1/TomcatApplet
</VirtualHost>

<VirtualHost 168.12.12.22:80>
ProxyPass /Site2/TomcatApplet http://1.1.1.2/Site2/TomcatApplet
ProxyPassReverse /Site2/TomcatApplet http://1.1.1.2/Site2/TomcatApplet
</VirtualHost>

http://1.1.1.1/Site1/TomcatApplet and http://1.1.1.2/Site2/TomcatApplet are java applets that receive the requests coming to the reverse proxy.

I set Apache Tomcat to display a generic error page whenever the request would no go to that applet. So i added to each applet's WEB_INF\web.xml:

<error-page>
    <error-code>400</error-code>
    <location>/error.html</location>
</error-page>

<error-page>
    <error-code>404</error-code>
    <location>/error.html</location>
</error-page>   

<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/error.html</location>
</error-page>

The idea is that if I go to http://168.12.12.12/Site1/TomcatApplet it'll be ok, but if I go to http://168.12.12.12/Site1/SomeNonExistantPage it will display the generic error.

If I remove the VirtualHost it works, if I add it, it doesn't. How do I do this then? i need the VirtualHost config to be there, 168.12.12.12 and 168.12.12.22 are virtual NICs and I wanted to redirect each one to the proper location.

Thank you

share|improve this question

1 Answer 1

your ProxyPass is too specific. Only matches for /Site1/TomcatApplet* get proxied.

try this;

<VirtualHost 168.12.12.12:80>
ProxyPass /Site1/ http://1.1.1.1/Site1/
ProxyPassReverse /Site1/ http://1.1.1.1/Site1/
</VirtualHost>

<VirtualHost 168.12.12.22:80>
ProxyPass /Site2/ http://1.1.1.2/Site2/
ProxyPassReverse /Site2/ http://1.1.1.2/Site2/
</VirtualHost>
share|improve this answer
    
Already tried that. Same results –  Mr Aleph Mar 9 '12 at 17:55
    
OK, but with your example, /Site1/SomeNonExistantPage is always served on apache. What page is apache serving (ie what content) instead of your generic error page for that? –  Tom H Mar 9 '12 at 18:09

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.