# X-accel-redirect and gzip\_static

**URL:** <https://www.ruby-forum.com/t/x-accel-redirect-and-gzip-static/215034>\
**Category:** NGINX\
**Created:** [December 20, 2011, 1:03am UTC](https://www.ruby-forum.com/t/x-accel-redirect-and-gzip-static/215034 "2011-12-20T01:03:33Z")\
**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:** [December 20, 2011, 1:03am UTC](https://www.ruby-forum.com/t/x-accel-redirect-and-gzip-static/215034/1 "2011-12-20T01:03:33Z")

</div>

I’m using x-accel-redirect to serve a file from a location that has  
gzip\_static on; however instead of the pre-gzipped version, I am  
getting me the un-gzip’d version of the file. I assume that locations  
are respected for x-accel-redirects targets, what am I missing / where  
should I look for more details? Config snippet follows.

# This is the canonical name which redirects to the x\_accel\_redirect

location  
location ~  
/dispatch/.\*/(ric\_sw\_version|config.xml|employee.xml|config\_data.xml))  
{  
gzip off;

```
fastcgi_pass webservices;
include include/fastcgi.conf;
fastcgi_intercept_errors off;
break;

```

}

# this is the direct-route to the dispatched location

location /dispatch {  
root /nutricate/static;  
gzip\_static on;  
gzip\_proxied any;  
break;  
}

# this is the x\_accel\_redirect target where the canonical name redirects

to.  
location /x\_accel\_redirect {  
internal;  
alias /nutricate/static/;  
gzip\_static on;  
gzip\_proxied any;  
}  
}

---

<div class="post-metadata">

**Author:** ![pond](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@pond](https://www.ruby-forum.com/u/pond)\
**Post date:** [August 15, 2012, 12:59pm UTC](https://www.ruby-forum.com/t/x-accel-redirect-and-gzip-static/215034/2 "2012-08-15T12:59:27Z")

</div>

I’m experiencing the same problem. Have you managed to find a  
workaround/fix?

Posted at Nginx Forum:

> **[Re: x-accel-redirect and gzip\_static](https://forum.nginx.org/read.php?2,220280,229715#msg-229715)**
>
> I'm using x-accel-redirect to serve a file from a location that has gzip\_static on; however instead of the pre-gzipped version, I am getting me the un-gzip'd version of the file. I assume that locations are respected for x-accel-redirects targets,...

---

<div class="post-metadata">

**Author:** ![pond](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@pond](https://www.ruby-forum.com/u/pond)\
**Post date:** [August 16, 2012, 9:41am UTC](https://www.ruby-forum.com/t/x-accel-redirect-and-gzip-static/215034/3 "2012-08-16T09:41:09Z")

</div>

Redirect is very necessary, you could pass the weight

.

Posted at Nginx Forum:

> **[Nginx Forum :: Nginx Mailing List - English](https://forum.nginx.org/read.php?2,220280,229769#msg-229769)**
>
> A portal to and from the mailing list.
