Maxim Dounin
January 20, 2013 07:40PM
Hello!

On Fri, Jan 18, 2013 at 06:11:06AM -0500, wingoo wrote:

> my environment is nginx(1.3.11) + php-fpm
>
> curl -I -H "Accept-Encoding: gzip,deflate" http://www.ihezhu.com/
>
> HTTP/1.1 200 OK
> Server: nginx
> Date: Fri, 18 Jan 2013 05:18:31 GMT
> Content-Type: text/html; charset=utf-8
> Connection: keep-alive
> Vary: Accept-Encoding
> Set-Cookie: PHPSESSID=2quqa651uglt62ku49re2nt1n4; path=/
> Expires: Thu, 19 Nov 1981 08:52:00 GMT
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0
> Pragma: no-cache
> Content-Encoding: gzip
>
> but when use browser like chrome and it's response not contain
> Content-Encoding, what's wrong?
>
> my nginx setting is
>
> gzip on;
> gzip_buffers 4 16k;
> gzip_comp_level 3;
> gzip_http_version 1.1;
> gzip_min_length 1k;
> gzip_proxied any;
> gzip_types text/plain text/css application/json application/x-javascript
> text/xml application/xml application/xml+rss text/javascript;
> gzip_vary on;
> gzip_disable msie6;
>
> thanks

It looks like something on your host interferes with normal
request handling. Probably some firewall with content
inspection and/or antivirus software.

I was able to simplify test case down to the LF vs CRLF difference
in the following requests:

$ (printf "GET / HTTP/1.1\r\nHost: www.ihezhu.com\r\nAccept-Encoding: gzip\r\n\r\n"; sleep 1) | nc 210.51.54.180 80 | grep Content-Encoding
$ (printf "GET / HTTP/1.1\nHost: www.ihezhu.com\nAccept-Encoding: gzip\n\n"; sleep 1) | nc 210.51.54.180 80 | grep -a Content-Encoding
Content-Encoding: gzip

No gzip is returned with proper CRLF newlines, while with just
bare LFs gzip is returned (likely because it bypasses content
inspection in question).

Try disabling your antivirus software to see if it helps.

--
Maxim Dounin
http://nginx.com/support.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

curl can response gzip but browser can't

wingoo January 18, 2013 06:11AM

Re: curl can response gzip but browser can't

Maxim Dounin January 20, 2013 07:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 234
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready