How to set up apache to serve no error page content? I don't want the default behavior, blank or custom page. I want return no content except headers, that all browsers must display own native error page. I'm using Apache 2.2.22
I'm fairly sure you can't do this Apache goes to some lengths to be helpful. From the ErrorDocument documentation
In the event of a problem or error, Apache httpd can be configured to do one of four things,
- output a simple hardcoded error message
the rest being custom/local/and remote error documents. Later the documentation says
Additionally, the special value default can be used to specify Apache httpd's simple hardcoded message.
So it appears that the default behaviour is to provide a hard coded ErrorDocument and that you can't override that in the way that you want.
If your Apache has PHP, Perl or any other dynamic extension capable of HTTP header control, then do create a custom page, which responds with the HTTP header fields you want (e.g. by using the PHP
header()), but with no other content such as HTML.
ErrorDocument directive to that custom page should produce the result you want.
Note: I'm aware your question asks how to accomplish the response by setting up Apache to serve no error page content and to not use any custom page. The answer above is valid only if you are not constrained to how the actual problem (i.e. giving a HTTP response containing only HTTP header fields) should be solved. Do you really have the constraint that the actual problem (i.e. desired outcome) must not be solved by involving any custom page?
Have you tried setting empty
ErrorDocument directives? Did it work?
ErrorDocument 404 ""
ErrorDocument 404 /path/to/empty/file.html
Apache might be helpful and ignore empty values so you may have to send a space or a
<html></html> to prevent it from overriding your values.
It's worth mentioning that browsers don't have error pages for all the different possible error codes. It is the Server's responsibility to provide those pages. When browsers do display their own error pages, it's likely that it will be generic and misleading.
Internet Explorer is unique in thinking it knows better than the server and will override your error pages if they are less than 512 bytes. The others only provide error pages for the situations where the server can't such as a DNS lookup error, a reset connection or a redirect loop. In most browsers, what you will get if you send an empty error document is a blank page.