Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 3 down vote accepted

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,

  1. 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.

share|improve this answer
It's not so good... – kbec May 16 '12 at 8:48

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.

Setting 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?

share|improve this answer

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.

share|improve this answer
When I use "" the apache reported ErrorDocument takes two arguments, Change responses for HTTP errors on restart. Second solution is just blank page and browser display it either own page. In some random cases my Chrome relly display own errpage, but not always. Maybe if I can change/remove content type it can work, but how? – kbec May 16 '12 at 8:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.