I have a reverse proxy Apache that is moving the request to a Tomcat servlet. The configuration on the Virtual Host in Apache is:
<VirtualHost 10.10.10.10:80>
ProxyPass /Site1/ServLet1 http://1.1.1.1/Site1/ServLet1
ProxyPassReverse /Site1/ServLet1 http://1.1.1.1//Site1/ServLet1
ProxyPass /Site2/ServLet2 http://2.2.2.2/Site2/ServLet2
ProxyPassReverse /Site2/ServLet2 http://2.2.2.2/Site1/ServLet1
</VirtualHost>
Essentially, if it comes to 10.10.10.10
and requests /Site1/ServLet1
, route it to /Site1/ServLet1
.
if I add
<VirtualHost 10.10.10.10:80>
ProxyPass /Site1/ServLet1 http://1.1.1.1/Site1/ServLet1
ProxyPassReverse /Site1/ServLet1 http://1.1.1.1//Site1/ServLet1
ErrorDocument 404 /customerrors/site1/404.html
ProxyPass /Site2/ServLet2 http://2.2.2.2/Site2/ServLet2
ProxyPassReverse /Site2/ServLet2 http://2.2.2.2/Site1/ServLet1
</VirtualHost>
so it will show a custom error for site1
(I set the ErrorDocument), it will be served to both.
How can I have a different 404 error page per site maintaining this kind of configuration?
Thank
Edit:
if I modify the configuration based on the comments below like:
<Location /Site1/ServLet1/>
ProxyPass http://1.1.1.1/Site1/ServLet1
ProxyPassReverse http://1.1.1.1/Site1/ServLet1
ErrorDocument 404 /customerrors/site1/404.html
</Location>
Then I can still get to http://1.1.1.1/Site1/ServLet1
but no error page is displayed whatsoever