191919
September 17, 2009, 12:00pm
1
Hi there,
I encountered a problem when using gzip_min_length with upstream + ssi:
ssi on;
gzip_min_length 1024;
upstream fastcgi_backends
{
server unix:/tmp/nx-fastcgi.sock.00;
}
I wrote a PHP script as:
<?
header('Content-Length: 3');
echo '123';
?>
and requested as:
GET /2.php HTTP/1.0
Accept-Encoding: gzip, deflate
nginx returned:
HTTP/1.1 200 OK
Server: nginx/0.8.15
Date: Thu, 17 Sep 2009 09:39:57 GMT
Content-Type: text/html
Connection: close
X-Powered-By: PHP/5.2.8
Vary: Accept-Encoding
Content-Encoding: gzip
3426???
As you see, the content is compressed despite of gzip_min_length = 1024.
When I turned off ssi (ssi off;), gzip_min_length works:
HTTP/1.1 200 OK
Server: nginx/0.8.15
Date: Thu, 17 Sep 2009 09:48:11 GMT
Content-Type: text/html
Connection: close
X-Powered-By: PHP/5.2.8
Content-Length: 3
Vary: Accept-Encoding
123
(Commenting out “ngx_http_clear_content_length®;” in
ngx_http_ssi_filter_module.c also works, I didn’t test whether ssi still
worked.)
Regards,
jh
191919
September 17, 2009, 12:14pm
2
On Thu, Sep 17, 2009 at 05:51:33PM +0800, 191919 wrote:
Accept-Encoding: gzip, deflate
Content-Encoding: gzip
Content-Type: text/html
Connection: close
X-Powered-By: PHP/5.2.8
Content-Length: 3
Vary: Accept-Encoding
123
(Commenting out “ngx_http_clear_content_length®;” in
ngx_http_ssi_filter_module.c also works, I didn’t test whether ssi still
worked.)
SSI deletes “Content-Length” so gzip module does not know about it.
191919
September 17, 2009, 12:19pm
3
Will nginx support using ssi + gzip?
2009/9/17 Igor S. [email protected]
191919
September 17, 2009, 12:24pm
4
On Thu, Sep 17, 2009 at 06:11:53PM +0800, 191919 wrote:
Will nginx support using ssi + gzip?
nginx supports ssi+gzip. However, gzip_min_length does not work in this
case.
191919
September 17, 2009, 12:38pm
5
On Thu, Sep 17, 2009 at 06:25:42PM +0800, 191919 wrote:
Just a suggestion: gzip module waits for gzip_min_length bytes, if there is
enough data, it starts compressing.
There are two modules that send response header only after they
processed whole response. However, now I’m not ready to modify
the gzip filter: there is already undocumented and buggy
postpone_gzipping
directive that postpone zlib memory allocation and some time nginx can
not
complete response.
191919
September 17, 2009, 12:31pm
6
Just a suggestion: gzip module waits for gzip_min_length bytes, if there
is
enough data, it starts compressing.
2009/9/17 Igor S. [email protected]