Server level custom error pages not working.
Hi :) In my setup, I want to show a custom error page when mod security (owasp) throws an error like 403. I use openlitespeed.
How can I make this happen? I tried putting custome error pages on the server config level (httpd_conf.conf) with no success like this:
context /error.html {
location /var/www/vhosts/localhost/html/error.html
allowBrowse 1
indexFiles error.html
}
include /usr/local/lsws/conf/custom_error_pages.conf
I tried also putting the custom error pages on vhost level, no success...
I found that the 403 pages come out of httpsstatuscode.cpp https://github.com/litespeedtech/openlitespeed/blob/252f18c1c56fcd6ccbea17ddd9d27696470eed31/src/http/httpstatuscode.cpp#L207.
Please advise :)
You can customize error page under each individual virtual host, under "General" tab -> "Customized Error Pages" table.
thanks for the response, but I see you did not understand the situation. I am not looking to customize the pages for a vhost, but for the moment when the owasp security module returns a 403 error. In this case the error page is rendered from the openlitespeed server code, not from any vhost. Please advise.
Regards.
At this moment it’s not possible. The response is hardcoded inside httpstatuscode.cpp (https://github.com/litespeedtech/openlitespeed/blob/master/src/http/httpstatuscode.cpp).
It would be interesting to refactor all that code to provide not only fully customizable general error pages but also better condition checking.
Because I also experience that when using a proxy inside a VHost, sometimes it returns the hardcoded 503 instead of the customized error page belonging to the VHost.