﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
965	gzip_static isn't working with proxy_pass	tomcruise81@…		"I've been trying to get [http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html gzip_static] working for a few days now. It appears that it only works for [http://nginx.org/en/docs/http/ngx_http_core_module.html#location location's] configured for direct serving of content (i.e. with a '''root''') versus location's with a [http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass proxy_pass].

For instance, here's a portion of my nginx.conf file:

{{{
        # ROOT_LOCATION
        location / {
            gzip            on;
            gzip_comp_level 6;
            gzip_vary       on;
            gzip_min_length 1000;
            gzip_proxied    any;
            gzip_types      text/plain text/html text/css application/json text/javascript application/javascript application/x-javascript text/xml application/xml application/xml+rss;
            gzip_buffers    16 8k;

            proxy_pass      http://localhost:3001/;
        }

        ## GZIPPED_ABSOLUTE - WORKS - C:/WS/application is where http://localhost:3001 is rooted
        #location /dist/gzipped {
        #    gzip_static    on;
        #    root           C:/WS/application;
        #}

        ## GZIPPED_PROXIED - DOESN'T WORK!!
        #location /dist/gzipped {
        #    gzip_proxied    any;
        #    gzip_vary       on;
        #    gzip_static     on;
        #    proxy_pass      http://localhost:3001/dist/gzipped;
        #}
}}}

I have both a boot.js file and a boot.js.gz version of the same file under C:/WS/application/dist/gzipped.

1. Requesting boot.js with the ""Accept-Encoding: gzip"" header and '''ONLY''' the ROOT_LOCATION section of the config un-commented results in the boot.js file being compressed on the fly (this can be verified by changing the [http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_comp_level gzip_comp_level]) and being returned with ""Content-Encoding: gzip"" and ""Content-Type: application/javascript"" among other things.
2. Requesting boot.js with the ""Accept-Encoding: gzip"" header and '''BOTH''' the ROOT_LOCATION and the GZIPPED_ABSOLUTE sections of the config un-commented results in the compressed boot.js.gz file being returned. This can be verified by checking the ""Content-Length"" header against the size of boot.js.gz.
3. Requesting boot.js with the ""Accept-Encoding: gzip"" header and '''BOTH''' the ROOT_LOCATION and the GZIPPED_PROXIED sections of the config un-commented results in the un-compressed boot.js file being returned. This can be verified by checking the ""Content-Encoding"" header and seeing that the response was not gzipped as well as checking the ""Content-Length"" header against the size of boot.js.

'''List item 3''' is where my problem and I believe a bug lies. I've verified that the version of nginx that I'm running was compiled with the '''--with-http_gzip_static_module''' option. Additionally, I've enabled writing to the error_log at the debug level. I see entries related to http static show up with the GZIPPED_ABSOLUTE section enabled, but not when I have the GZIPPED_PROXIED section enabled.

Please help!

Thanks!"	defect	closed	minor		nginx-module	1.9.x	invalid	gzip_static		MINGW32_NT-6.1 S34D00D 1.0.18(0.48/3/2) 2012-11-21 22:34 i686 Msys	"nginx version: nginx/1.9.15
built by cl 16.00.30319.01 for 80x86
built with OpenSSL 1.0.2g  1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-8.38 --with-zlib=objs.msvc8/lib/zlib-1.2.8 --with-select_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-openssl=objs.msvc8/lib/openssl-1.0.2g --with-openssl-opt=no-asm --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-ipv6"
