Displaying custom error pages on different VirtualHosts in Apache
I'm not sure what you mean by "different VirtualHosts", since these are in the same one.. but I think you'll want to do something like this (and consider moving the ProxyPass
statements into the <Location>
blocks too, if you can):
<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
<Location /Site1>
ErrorDocument 404 /customerrors/site1/404.html
</Location>
ProxyPass /Site2/ServLet2 http://2.2.2.2/Site2/ServLet2
ProxyPassReverse /Site2/ServLet2 http://2.2.2.2/Site2/ServLet2
<Location /Site2>
ErrorDocument 404 /customerrors/site2/404.html
</Location>
</VirtualHost>
Edit:
To have the Proxy
statements reside in the location blocks:
<VirtualHost 10.10.10.10:80>
<Location /Site1>
ErrorDocument 404 /customerrors/site1/404.html
</Location>
<Location /Site1/ServLet1>
ProxyPass http://1.1.1.1/Site1/ServLet1
ProxyPassReverse http://1.1.1.1/Site1/ServLet1
</Location>
<Location /Site2>
ErrorDocument 404 /customerrors/site2/404.html
</Location>
<Location /Site2/ServLet2>
ProxyPass http://2.2.2.2/Site2/ServLet2
ProxyPassReverse http://2.2.2.2/Site2/ServLet2
</Location>
</VirtualHost>
Make it so that each vhost has it's own VirtualHost definition.
<VirtualHost 10.10.10.10:80>
Servername site1.tld
ProxyPass /Site1/ServLet1 http://1.1.1.1/Site1/ServLet1
ProxyPassReverse /Site1/ServLet1 http://1.1.1.1//Site1/ServLet1
ErrorDocument 404 /customerrors/site2/404.html
</VirtualHost>
<VirtualHost 10.10.10.10:80>
ServerName site2.tld
ProxyPass /Site2/ServLet2 http://2.2.2.2/Site2/ServLet2
ProxyPassReverse /Site2/ServLet2 http://2.2.2.2/Site1/ServLet1
ErrorDocument 404 /customerrors/site2/404.html
</VirtualHost>
You'll also need to ensure that you have a suitable NameVirtualHost definition.