Welcome! Log In Create A New Profile

Advanced

Re: X-Accel-Redirect

Jeff Waugh
September 30, 2009 05:48AM
<quote who="pepejose">

> in short, how can I verify that X-Accel-Redirect is working?
>
> I looked at the headers with the plugin for firefox live http headers but
> I see no differences

Add a header to an exclusive chunk of your PHP code or nginx configuration.
For example:

if ( X_ACCEL_REDIRECT ) {
header("X-Accel-Redirect: /$image"); // nginx will strip this
header("X-For-The-Win: win"); // nginx won't strip this though
exit;
}
readfile($image); // won't *ever* have the X-For-The-Win header

You could also do something on the nginx side, but this lets you know that
your app is at least doing the right thing.

If you're proxy_pass-ing to the app, you can also just use curl or wget to
talk to it directly, to see which headers it's passing to nginx.

(Note that you can configure nginx to do *anything* based on the URL it gets
from the backend -> you could proxy_pass again, fastcgi_pass, whatever. But
it is most useful when you tell nginx to just serve up a static file.)

- Jeff

--
linux.conf.au 2010: Wellington, NZ http://www.lca2010.org.nz/

You know the end is nigh when modern art is relegated to the status of
"meme".
Subject Author Posted

X-Accel-Redirect

pepejose September 30, 2009 03:44AM

Re: X-Accel-Redirect

Gabriel Ramuglia September 30, 2009 04:44AM

Re: X-Accel-Redirect

Jeff Waugh September 30, 2009 05:06AM

Re: X-Accel-Redirect

pepejose September 30, 2009 05:12AM

Re: X-Accel-Redirect

Jeff Waugh September 30, 2009 05:48AM

Re: X-Accel-Redirect

Maxim Dounin September 30, 2009 06:12AM

Re: X-Accel-Redirect

Kiril Angov September 30, 2009 08:08AM

Re: X-Accel-Redirect

Jeff Waugh September 30, 2009 08:44AM

Re: X-Accel-Redirect

Gabriel Ramuglia September 30, 2009 01:30PM

Re: X-Accel-Redirect

pepejose September 30, 2009 10:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 252
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