Apache httpd will not return a custom error page on status code 400

Solution Verified - Updated -


I specified custom error page (html or CGI) to ErrorDocument on status code 400 like the followings:

ErrorDocument 400 /somepage.html


ErrorDocument 400 /cgi-bin/error.cgi

But Apache httpd did not return a custom error page for "400 Bad Reqeust" error response when a request is malformed. for example:

# sending an HTTP/1.1 request without Host header
$ curl -v http://localhost/ -H "Host:" 

# sending a large request header 
$ curl -v http://localhost/ -H "key: `perl -e 'print "a"x10000'`"


  • Red Hat Enterprise Linux 6.x
    • Apache httpd 2.2.15
  • Red Hat Enterprise Linux 7.x
    • Apache httpd 2.4.6
  • JBoss Enterprise Web Server (EWS) 1.0.x, 2.x
    • Apache httpd 2.2.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content