Opened 6 months ago

Last modified 6 months ago

#1446 new defect

gzip_types can't handle types longer than 46 chars

Reported by: craigds@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.8.x
Keywords: Cc:
uname -a: Linux vm 4.4.0-83-generic #106~14.04.1-Ubuntu SMP Mon Jun 26 18:10:19 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.8.0 built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1) built with OpenSSL 1.0.1f 6 Jan 2014 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-mail --add-module=/tmp/build.tmp/code/debian/modules/nginx-echo --add-module=/tmp/build.tmp/code/debian/modules/bodytime-nginx-module --add-module=/tmp/build.tmp/code/debian/modules/nginx-upload-progress-module --add-module=/tmp/build.tmp/code/debian/modules/nginx-upstream-fair --add-module=/tmp/build.tmp/code/debian/modules/ngx_http_substitutions_filter_module --add-module=/tmp/build.tmp/code/debian/modules/headers-more-nginx-module --add-module=/tmp/build.tmp/code/debian/modules/ngx_devel_kit --add-module=/tmp/build.tmp/code/debian/modules/lua-nginx-module --add-module=/tmp/build.tmp/code/debian/modules/nginx-x-rid-header --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/ossp' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -lossp-uuid' --with-ipv6

Description

We're using content types like application/vnd.koordinates.featureQuery1-dojo+gmaps+json to serve API responses.

We can't add them to gzip_types:

 * Restarting nginx nginx

nginx: [emerg] could not build the test_types_hash, you should increase test_types_hash_bucket_size: 64
nginx: configuration file /etc/nginx/nginx.conf test failed

Turns out nginx is rejecting any types over 46 characters.

This was mentioned in #203 but not fixed because the reporter was doing this unintentionally.

The only way to fix this at present appears to be to build nginx ourselves and change the magic number.

I think the appropriate magic number to change might be https://github.com/nginx/nginx/blob/752f66bf7d70fae2bf05fbf5941ff4be52b2b9a5/src/http/ngx_http.c#L2032
Any chance of setting that from a conf directive?

Btw, aware this is an old version of nginx, but from the source code I see no indication that it's been changed in recent releases.

Change History (2)

comment:1 Changed 6 months ago by i.bakirov@…

I agree, nowadays we have mime-types that goes beyond 64 character limit. For the reference https://www.iana.org/assignments/media-types/media-types.xhtml fast search show that we have 80 character long mime types as well.

May be double the size of current bucket size limit?

comment:2 Changed 6 months ago by mdounin

Note that to use gzip for arbitrary types you can consider using gzip_types *; in a particular location.

Note: See TracTickets for help on using tickets.