# X-Accel-Redirect to keep Etag from upstream?

**URL:** <https://www.ruby-forum.com/t/x-accel-redirect-to-keep-etag-from-upstream/208112>\
**Category:** NGINX\
**Created:** [June 10, 2011, 2:24pm UTC](https://www.ruby-forum.com/t/x-accel-redirect-to-keep-etag-from-upstream/208112 "2011-06-10T14:24:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [June 10, 2011, 2:24pm UTC](https://www.ruby-forum.com/t/x-accel-redirect-to-keep-etag-from-upstream/208112/1 "2011-06-10T14:24:06Z")

</div>

Hi,

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.

Regards.

Posted at Nginx Forum:

> **[X-Accel-Redirect to keep Etag from upstream?](https://forum.nginx.org/read.php?2,205636,205636#msg-205636)**
>
> Hi, 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...

---

<div class="post-metadata">

**Author:** ![unbeknownst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/b77776/32.png) [@unbeknownst](https://www.ruby-forum.com/u/unbeknownst)\
**Post date:** [June 10, 2011, 3:50pm UTC](https://www.ruby-forum.com/t/x-accel-redirect-to-keep-etag-from-upstream/208112/2 "2011-06-10T15:50:34Z")

</div>

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 D.

---

<div class="post-metadata">

**Author:** ![unbeknownst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/b77776/32.png) [@unbeknownst](https://www.ruby-forum.com/u/unbeknownst)\
**Post date:** [June 10, 2011, 4:36pm UTC](https://www.ruby-forum.com/t/x-accel-redirect-to-keep-etag-from-upstream/208112/3 "2011-06-10T16:36:59Z")

</div>

Thanks, it worked.

Regards.

Posted at Nginx Forum:

> **[Re: X-Accel-Redirect to keep Etag from upstream?](https://forum.nginx.org/read.php?2,205636,205673#msg-205673)**
>
> Hi, 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...
