I have two use cases:
HTTPD is a proxy for a Tomcat application
HTTPD is a proxy for a PHP application
For compliance and security needs all 50x errors must be rewritten to 503 prior to sending back to a client. Exposing 50x errors leaks information about your application, so is bad practice.
I still wish to see 500s in the HTTPD log files, but must rewrite the HTTP error sent back to clients.
Constraints:
Using an external program or other application is out of the question, i.e. varnish, pound, nginx et al.
I do not wish to send back an error page, I only need to rewrite the HTTP status. i.e. change the
HTTP/1.1 500
to a503
in the following:[user@host]$ curl -I http://localhost:8080/500.php HTTP/1.1 500 Internal Server Error <OUTPUT OMITTED>
Is this possible?
Note: I created error pages with:
for http_status in 401 403 500 501 503; do
echo -e "<?php\nhttp_response_code(${http_status});" > ${http_status}.php
done