0

I'm trying to figure out why Nginx doesn't compress CSS. Nginx config looks valid and typical for the tasks like that.

Failed test:

curl -H "Accept-Encoding: gzip" -I https://<hostname>/sites/default/files/css/css_xLFDRTFqZTZeUg7Pab0gP4cpz5TWo3PCH-KBo_HKQ6A.css

HTTP/1.1 200 OK
Server: nginx
Content-Type: text/css
Content-Length: 1123
ETag: "587c4cdc-463"
Cache-Control: max-age=2592000
Accept-Ranges: bytes

The response Content-Encoding should be gzip instead of text/css.

Nginx config:

http {
...
    gzip                                on;
    gzip_buffers                        16 8k;
    gzip_comp_level                     2;
    gzip_http_version                   1.1;
    gzip_min_length                     10240;
    gzip_types                          text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/x-icon application/vnd.ms-fontobject font/opentype application/x-font-ttf;
    gzip_vary                           on;
    gzip_proxied                        any;
    gzip_disable                        msie6;
...
}

1 Answer 1

2

Your gzip_min_length is set too large - you can see the Content-Length in your request debug and its way less than the minimum threshold.

Remove that altogether or set it much lower.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.