Question around Gzip static and CDN

Maxim Dounin mdounin at mdounin.ru
Fri Aug 22 19:14:24 MSD 2008


Hello!

On Fri, Aug 22, 2008 at 07:03:55PM +0530, Rakesh Rajan wrote:

> I have recently moved serving static files from Apache to Nginx ( 0.7.11  
> ). As a part of build, I gzip JS and CSS files and have complied nginx  
> using --with-http_gzip_static_module .
>
> When I access the page using,  
> http://static0.<mydomain>.com/js/test.v1.js , nginx serves the page  
> fine. The response headers looks like
>
> /Server nginx/0.7.11
> Date Fri, 22 Aug 2008 13:26:12 GMT
> Content-Type application/x-javascript
> Content-Length 1034
> Last-Modified Fri, 22 Aug 2008 12:12:49 GMT
> Connection keep-alive
> Content-Encoding gzip
> Expires Sat, 22 Aug 2009 13:26:12 GMT
> Cache-Control max-age=31536000
>
> /I am using Softlayer CDN ( which is backed by the above nginx ). Now,  
> the same request using the CDN does not work ( returns a 404 ).
>
> Note: In case I have only test.js ( instead of only test.js.gz ) then  
> both nginx and CDN works fine. And in case I have only test.js.gz then  
> only nginx works

For gzip_static module you must have both compressed and 
uncompressed versions of file.  Compressed one is used when client 
supports gzip, and uncompressed one if it doesn't.

Since your CDN doesn't work without uncompressed version - it 
probably doesn't support gzip (at least doesn't advertize it to 
nginx) and gzip_static module is useless here.

Maxim Dounin





More information about the nginx mailing list