Forum: NGINX error_page not redirecting as expected

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Maxim Khitrov (Guest)
on 2012-10-26 14:50
(Received via mailing list)

I'm sure it's something simple, but I don't know where the problem is
in the following configuration:

server {
  listen 80;
  root /path/to/webroot;

  error_page 404 /status/404;

  location / {
    try_files $uri @dynamic;

  location @dynamic {
    include fastcgi_params;
    fastcgi_pass unix:/tmp/myapp.sock;
    fastcgi_intercept_errors on;

I have some static files (css, js, etc.) under webroot that are served
by nginx. Everything else should be sent to @dynamic. If the initial
@dynamic request is answered with 404, I want nginx to make a second
request to @dynamic with the path set to /status/404.

What happens instead is that if the initial request receives a 404
response from the FastCGI responder, nginx serves the default 404 Not
Found page (not even the content returned by @dynamic) instead of
rewriting the request to /status/404. Opening /status/404 directly
works just fine.

Where did I make a mistake? There is nothing in the error log to give
me any hints.

- Max
This topic is locked and can not be replied to.