I'm trying to active gzip compression and I have set the option gzip_vary on; to include the Vary: Accept-Encoding header.
The problem is, my application is already seting a Vary: header.
So the response is now having two Vary: headers, one from my application and one from nginx.
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 17 Dec 2016 13:28:38 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
Last-Modified: Sat, 17 Dec 2016 13:28:38 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Vary: User-Agent
Content-Encoding: gzip
But I guess instead it should be rather like this:
Vary: Accept-Encoding, User Agent
How can I achieve this?
Best Answer
RFC2616 states duplicate headers are acceptable and should be treated the same as a single header with a comma-separated list of values:
So, you don't need to do anything to get the proper behavior.