Welcome! Log In Create A New Profile

Advanced

error_page not redirecting as expected

Maxim Khitrov
October 26, 2012 08:52AM
Hello,

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

server {
listen 80;
server_name example.com;
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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

error_page not redirecting as expected

Maxim Khitrov October 26, 2012 08:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 260
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready