2 messages in ru.sysoev.nginxRe: x-accel-redirect and status codes
FromSent OnAttachments
Brian MoranApr 7, 2009 2:32 pm 
Maxim DouninApr 7, 2009 2:51 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: x-accel-redirect and status codesActions...
From:Maxim Dounin (mdou@mdounin.ru)
Date:Apr 7, 2009 2:51:20 pm
List:ru.sysoev.nginx

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.