Welcome! Log In Create A New Profile

Advanced

Re: x-accel-redirect and status codes

Maxim Dounin
April 07, 2009 05:51PM
Hello!

On Tue, Apr 07, 2009 at 02:32:46PM -0700, Brian Moran wrote:

> We'd like nginx to be able to return a 404 error page using
> x-accel-redirect, BUT also have the status code returned to be 404; is
> this possible?

I don't actually understand reason - if you want 404 content to be
returned by frontend, you may use proxy_intercept_errors.

But if you really want to, try something like this:

location = /redirect-404-here {
error_page 404 /404.html;
return 404;
}

location = /404.html {
# here actual content should be returned
# it will have 404 status
...
}

and return "X-Accel-Redirect: /redirect-404-here". If you want
the same for multiple different files - it's easy too, just use
variables in error_page uri.

Maxim Dounin
Subject Author Posted

x-accel-redirect and status codes

Brian Moran April 07, 2009 05:32PM

Re: x-accel-redirect and status codes

Maxim Dounin April 07, 2009 05:51PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 111
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready