http-headerserlangyawshttp-accept-encoding

How to add "Vary: Accept-Encoding" header in yaws to cacheable files


I was testing my website for optimization and I got this recommendation:

The following publicly cacheable, compressible resources should have a "Vary: Accept-Encoding" header:

So, How do I add Vary: Accept-Encoding header using an embedded yaws to css and js files?

I am an arg_rewrite_mod I believe I should do something from there but i am not quite sure how.


Solution

  • According to the yaws.hyber.org:
    Yaws will add Accept-Encoding in Vary header if the support of gzip compression is enabled or if the response is compressed.
    The Vary header can be set using yaws:outh_set_vary(Fields) or by returning {header, {vary, Fields}} from scripts (where Fields is a list of header names).