X-Accel-Redirect
Jeff Waugh
jdub at bethesignal.org
Wed Sep 30 13:43:51 MSD 2009
<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".
More information about the nginx
mailing list