Set Vary: Accept-Encoding Header (nginx)

前端 未结 4 1666
生来不讨喜
生来不讨喜 2021-02-05 01:47

I have an nginx server and can\'t seem to find any information on how to send Vary: Accept-Encoding headers for CSS and JS files. Does anyone have info about this?

Thank

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 02:06

    Inside the server { of the domain/subdomain that you want to set it, add

        gzip on;
        gzip_min_length  1100;
        gzip_buffers  4 32k;
        gzip_types    text/plain application/x-javascript text/xml text/css;
        gzip_vary on;
    

    Save the file and restart nginx.

提交回复
热议问题