﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
718	Simultaneous xslt and gzip_static yields error 500	Forst		"'''Environment:'''
Path `/foo/bar/` contains an XML-file `foobar.xml`, its compressed version `foobar.xml.gz` and a stylesheet `foobar.xsl`.

'''Configuration (simplified):'''
{{{
location / {
    root /;
    gzip_static on;
}
location /foo/bar/test/ {
    alias /foo/bar/;
    index foobar.xml;
    xslt_stylesheet /foo/bar/feed.xsl;
    xslt_last_modified on;
}
}}}

'''Steps to reproduce:'''
1. Navigate to `http://example.com/foo/bar/test`

'''Expected behavior:'''
Generated XHTML page is sent to the browser and displayed appropriately.

'''Actual result:'''
Error 500: Internal Server Error.
This appears in the error log:
{{{
[error] 31057#0: *1 libxml2 error: ""Document is empty"" while sending response to client
[error] 31057#0: *1 xmlParseChunk() failed, error:4 while sending response to client
}}}

'''Workaround:'''
Add `gzip_static off;` to `location /foo/bar/test/`.

However, this obviously disables the feature for all the files available through `/foo/bar/test/`. As the XML file is used as the index, I don't see an elegant way to disable `gzip_static` just for that file, as using `location = /foo/bar/test/` will override all other options set in `location /foo/bar/test/` and duplicating all options in both locations is undesirable.

'''Notes:'''
According to this topic: [http://forum.nginx.org/read.php?21,120601,120601], the error is caused when libxml2 receives compressed input. It seems doubtful to me that current behavior (serving the precompressed file to libxml2) is correct."	defect	new	minor		nginx-module	1.7.x		xslt, gzip_static		Linux example.com 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.7.10
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 
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_flv_module --with-http_mp4_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-http_xslt_module --with-mail --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' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --with-ipv6"
