http-compression-vary #

Adds a Vary: Accept-Encoding header to responses that may be compressed, in place of gzip_vary. Use it when you compress with more than gzip, such as Brotli or Zstandard, so caches keep the encodings apart.

Source: upstream source

Directives

compression_vary #

syntax: compression_vary on | off;  ·  default: compression_vary off;  ·  context: http, server, location

Enables or disables inserting the Vary: Accept-Encoding response header field if the directives gzip, gzip_static, or gunzip are active. Note that compression_vary should not be used simultaneously with gzip_vary, as this will result in duplicate Vary headers.

Example

server {
    listen 127.0.0.1:8080;
    server_name localhost;

    location / {
        gzip on;
        gzip_vary off;           # Disable gzip_vary to avoid conflicts with compression_vary
        compression_vary on;

        proxy_pass http://foo.com;
    }
}

↑ back to index