# Gzip working for 443 but not 80 in same listener?

**URL:** <https://www.ruby-forum.com/t/gzip-working-for-443-but-not-80-in-same-listener/244453>\
**Category:** NGINX\
**Created:** [April 12, 2016, 10:48pm UTC](https://www.ruby-forum.com/t/gzip-working-for-443-but-not-80-in-same-listener/244453 "2016-04-12T22:48:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [April 12, 2016, 10:48pm UTC](https://www.ruby-forum.com/t/gzip-working-for-443-but-not-80-in-same-listener/244453/1 "2016-04-12T22:48:46Z")

</div>

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](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](https://wwwtest.vishay.com/scripts/6a1ffc5abe3087be4ead5451c1651f74ee0672f3/scripts/satellite-56dd434664746d0550000142.js)

only the https shows  
Content-Encoding: gzip

What am I missing??

Thanks,  
Lee

Posted at Nginx Forum:

> **[gzip working for 443 but not 80 in same listener?](https://forum.nginx.org/read.php?2,266128,266128#msg-266128)**
>
> 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;

---

<div class="post-metadata">

**Author:** ![lfisher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/43a26b/32.png) [@lfisher](https://www.ruby-forum.com/u/lfisher)\
**Post date:** [April 12, 2016, 11:32pm UTC](https://www.ruby-forum.com/t/gzip-working-for-443-but-not-80-in-same-listener/244453/2 "2016-04-12T23:32:35Z")

</div>

On Tuesday 12 April 2016 16:48:27 lfisher wrote:

> ```
> gzip_vary on;
> 
> ```
> 
> 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](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](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://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
