Set Vary: Accept-Encoding Header (nginx)

前端 未结 4 1658
生来不讨喜
生来不讨喜 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:14

    This is from the nginx documentation.

    gzip_vary
    syntax: gzip_vary on|off
    default: gzip_vary off
    context: http, server, location
    

    Enables response header of "Vary: Accept-Encoding". Note that this header causes IE 4-6 not to cache the content due to a bug (see 2 ).

    There if you just add gzip_vary on; it should do it's job.

    Also make sure you have any one of the directives gzip, gzip_static, or gunzip are active.

提交回复
热议问题