gzip working for 443 but not 80 in same listener?

Валентин Бартенев vbart at nginx.com
Tue Apr 12 21:32:25 UTC 2016


On Tuesday 12 April 2016 16:48:27 lfisher wrote:
> I added port 80 in my listener.
> # HTTPS server
> server {
>    listen 80;
>    listen 443 ssl;
> 
> Gzip still works on 443, but css/js are not getting gzipped in port 80.
> 
> My nginx.conf has
>     gzip  on;
>         gzip_vary on;
>         gzip_min_length 500;
>         gzip_buffers  4 32k;
>         gzip_comp_level 6;
>         # gzip_proxied expired no-cache no-store private auth;
>         gzip_proxied any;
>         gzip_types text/plain text/css text/xml text/javascript
> application/json application/javascript application/x-javascript
> application/xml application/xml+rss;
>         # gzip_types text/plain text/css application/json
> application/x-javascript text/xml application/xml application/xml+rss
> text/javascript;
>         gzip_disable "MSIE [1-6]\.";
> 
> I tried adding this but it didn't seem to help
>         # it wasn't compressing for port 80
>         gzip_http_version 1.0;
> 
> 
> I can also see if I do
> curl --header "Accept-Encoding: gzip,deflate,sdch" -sI
> 
http://wwwtest.vishay.com/scripts/6a1ffc5abe3087be4ead5451c1651f74ee0672f3/scripts/satellite-56dd434664746d0550000142.js
> 
> vs
> 
> curl --header "Accept-Encoding: gzip,deflate,sdch" -sI
> 
https://wwwtest.vishay.com/scripts/6a1ffc5abe3087be4ead5451c1651f74ee0672f3/scripts/satellite-56dd434664746d0550000142.js
> 
> only the https shows
> Content-Encoding: gzip
> 
> What am I missing??
> 
[...]

Works fine:

% curl --header "Accept-Encoding: gzip,deflate,sdch" -sI 
http://wwwtest.vishay.com/scripts/6a1ffc5abe3087be4ead5451c1651f74ee0672f3/scripts/satellite-56dd434664746d0550000142.js
HTTP/1.1 200 OK
Server: nginx
Content-Type: application/javascript
Last-Modified: Thu, 10 Mar 2016 15:49:44 GMT
Vary: Accept-Encoding
ETag: "56e19798-c70"
Strict-Transport-Security: max-age=31536000;
Accept-Ranges: bytes
Content-Encoding: gzip
Cache-Control: max-age=2591947
Expires: Thu, 12 May 2016 21:26:40 GMT
Date: Tue, 12 Apr 2016 21:27:33 GMT
Content-Length: 20
Connection: keep-alive

  wbr, Valentin V. Bartenev



More information about the nginx mailing list