Opened 10 years ago

Closed 10 years ago

#477 closed defect (invalid)

gunzip does not decompress gzip static content for clients that do not support gzip encoding

Reported by: Nick B Owned by:
Priority: minor Milestone:
Component: nginx-module Version:
Keywords: gzip_static, gunzip Cc:
uname -a: Linux 2.6.32-52-generic-pae #114-Ubuntu SMP Wed Sep 11 19:15:42 UTC 2013 i686 GNU/Linux
nginx -V: nginx version: nginx/1.5.7
built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
TLS SNI support enabled
configure arguments: --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_stub_status_module --with-debug --with-cc-opt='-g -O0'

Description

Using the following directives in the http section of the conf file:

gzip_disable msie6;
gzip_vary on;
gzip_http_version 1.1;
gzip_static on;
gunzip on;

With a gzip file "index.html.gz" and no ordinary file "index.html" in the root directory

curl http://192.168.1.10:8111/index.html -H 'Accept-Encoding: gzip,deflate' - Works
curl http://192.168.1.10:8111/index.html - returns 404 File Not Found

Through a hack I can get it to return an uncompressed (using gunzip module) version if I comment out the second condition check from ngx_http_gzip_static_module.c:ngx_http_gzip_static_handler L112:

if (gzcf->enable == NGX_HTTP_GZIP_STATIC_OFF) {

return NGX_DECLINED;

/*}

if (gzcf->enable == NGX_HTTP_GZIP_STATIC_ON) {

rc = ngx_http_gzip_ok(r);

*/
} else {

/* always */
rc = NGX_OK;

}

I'm not familiar with the nginx code base so this may not be the most appropriate place. It seems the function ngx_http_gzip_ok checks whether the client can accept gzip encoding. Perhaps this function should take into consideration whether the gunzip module is activated.

Change History (1)

comment:1 by Maxim Dounin, 10 years ago

Resolution: invalid
Status: newclosed

There is gzip_static always to do what you want.

Note: See TracTickets for help on using tickets.