X-Accel-Redirect to keep Etag from upstream?

Maxim Dounin mdounin at mdounin.ru
Fri Jun 10 17:50:07 MSD 2011


Hello!

On Fri, Jun 10, 2011 at 08:23:45AM -0400, unbeknownst wrote:

> I'm using nginx 1.0.0 and I wonder if there is any way of telling
> "X-Accel-Redirect" to keep the "Etag" header.
> The rest of the headers from upstream are kept when I set
> "X-Accel-Redirect" but "Etag" seems to be removed.

There are several headers which are kept on X-Accel-Redirect:

"Content-Type", "Set-Cookie", "Content-Disposition", 
"Cache-Control", "Expires", "Accept-Ranges"

Others aren't kept by default.  If you want to keep them, try 
something like

    add_header Etag $upstream_http_etag;

in the location your X-Accel-Redirect points to.

(if you proxy_pass to another server after X-Accel-Redirect, you 
will have to save $upstream_http_etag to temporary variable via set 
directive, but this is another story)

Maxim Dounin



More information about the nginx mailing list