httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Spiegle <>
Subject [users@httpd] Why does mod_deflate always add the 'Vary' header?
Date Tue, 30 Aug 2011 18:42:26 GMT
I was beating my head against a wall for a day about a caching issue,
but I think I figured the problem out now.  It seems like mod_deflate
is adding the 'Vary' header to all responses regardless of whether
they were actually compressed or not.  Here's a snippet of the HTTP
session for a static HTML file:

$ curl --header 'Host:' -v -s -o/dev/null
* About to connect() to X.X.X.X port 80 (#0)
*   Trying X.X.X.X... connected
* Connected to X.X.X.X (X.X.X.X) port 80 (#0)
> GET /static.htm HTTP/1.1
> User-Agent: curl/7.21.7 (x86_64-pc-linux-gnu) libcurl/7.21.7 NSS/ zlib/1.2.5
> Accept: */*
> Host:
< HTTP/1.1 200 OK
< Date: Tue, 30 Aug 2011 18:39:47 GMT
< Server: Apache
< Last-Modified: Tue, 30 Aug 2011 17:59:49 GMT
< Accept-Ranges: bytes
< Content-Length: 247
< Vary: Accept-Encoding
< Cache-Control: max-age=2592000
< Connection: close
< Content-Type: text/html
{ [data not shown]
* Closing connection #0

I then referenced the mod_deflate.c source code, and found the following:
       /* Even if we don't accept this request based on it not having
        * the Accept-Encoding, we need to note that we were looking
        * for this header and downstream proxies should be aware of that.
       apr_table_mergen(r->headers_out, "Vary", "Accept-Encoding");

What is the reasoning for adding the 'Vary' header even if mod_deflate
does nothing with the response?


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message