I have an Apache web server in front of another application server, using Proxy Pass. When the request to application returned error 404, I want to show custom error page from the web server not the one that come from application server. I have tried to setup the ErrorDocument 404 on the virtual host, but it doesn't work. How should I do this? Or this is not possible?
<VirtualHost *:80>
ServerName servername
DocumentRoot /somepath/
ProxyPass / http://localhost:8080/someapp/
ProxyPassReverse / http://localhost:8080/someapp/
ErrorDocument 404 /error.html
</VirtualHost>
You can avoid proxying for a specific directory by specifying a
!
in place of the proxy target. Since it acts on a directory, moveerror.html
into a subdirectory (we'll sayerrors
), and: