Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude 404 from being served from apache

I have apache configured as reverse proxy to liferay tomcat, 5 virtual hosts are configured on liferay tomcat, below configuration is used to serve error pages from apache.

Alias /error/ "/usr/share/apache2/error/"
Options -Indexes
ProxyPassMatch /error/(403|5xx) !
ProxyErrorOverride On
ErrorDocument 500 /error/5xx/500.html
ErrorDocument 403 /error/403/403.html

Problem is 404 hits are also being served by apache because of ProxyErrorOverride, is there a way I can bypass 404 so that will be served from backend server ?

This way I can have separate 404 pages for different virtual hosts. Since virtual hosts are not configured on apache, I cant tell apache to serve different error pages for different site.

I want to keep serving 403 and 500 from apache so ProxyErrorOverride cant be Off.

like image 984
Deepak Deore Avatar asked Oct 28 '15 00:10

Deepak Deore


1 Answers

You can have multiple virtual hosts on Apache. Just point them all to the same app server and make sure that you preserve host.

Then you can make the configuration per virtual host on the app server.

like image 148
Miroslav Ligas Avatar answered Nov 13 '22 10:11

Miroslav Ligas