I added custom error page to Nginx by these lines:
error_page 400 /custom.html;
location = /custom.html {
root /somewhere/html;
internal;
}
location /test {
return 400;
}
It returns my custom error page for test location; The problem is for some requests like when request header is too large, It still returns the default error page of Nginx.
<html>
<head><title>400 Request Header Or Cookie Too Large</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>Request Header Or Cookie Too Large</center>
<hr><center>nginx</center>
</body>
</html>