NGINX + GZIP – Altering Vary header to include User-Agent

gziphttp-headersnginx

Currently, when nginx is set to gzip outbound content as requested by the client, the "gzip_vary on" setting will set the following header:

Vary: Accept-Encoding

We would like to modify this to send out:

Vary: Accept-Encoding, User-Agent

Is this possible?

Thanks.

Best Answer

The module ngx_headers_more allows you to change http headers :

more_set_headers -s 200 "Vary: " "Accept-Encoding, User-Agent";

Not tested!