Error message control when using nginx as proxy

I have setup nginx as a front proxy, it passes php requests to Apache.

When I now try to access my site through, say, “TRACE”, then naturally I
see the 405 error. But this is a nginx default message. How can I make
sure that I see my own customized error page?

I have this in my “Server” definition…

#================================

Custom error page…

#================================
error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415
416 417 495 496 497
500 501 502 503 504 505 506 507 /error.htm;

But this does not seem to be working. For the 405, it still shows the
default nginx page. Anything I can do about this?

Secondly, for Apache, there is still some mod_security stuff that sends
back a “406”. How can I make sure that Apache sending that signal back
to Nginx only triggers the 406 I have setup in nginx?

Thanks!

Posted at Nginx Forum: