Thank you Maxim, that was what I was looking for. However, it is still not returning the static error page. Does nginx expect a certain response format from the fcgi server? I tried:
"HTTP/1.1 400 Bad Request\r\nStatus: 400 Bad Request\r\n";
and
"HTTP/1.1 400 Bad Request";
The nginx.conf has:
root ...;
location xxx {
include fastcgi_params;
fastcgi_pass ...;
error_page 400 /my_bad_request; <-- inside or outside this location block didn't make a difference
fastcgi_intercept_errors on;
}
location /my_bad_request {
try_files /bad_request.html = 400;
}
Thank you!