httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raphaƫl Droz <>
Subject [users@httpd] mod_cache_disk: .header and strange Vary: User-Agent
Date Fri, 23 Oct 2015 02:51:31 GMT
I recently received a dozens of AH00708: errors in my logs.
> (2)No such file or directory: AH00708: Cannot open data file /var/cache/apache2/mod_cache_disk/Y/Z/CLVvRR_4nNWabdUv_5wA.header.vary/B/z/

Said file does not exist, only does the corresponding .header file.
The cache is 455 MB, I don't know what could have happened and I
activated debug loglevel for mod_cache_disk for next days in order to
understand why the data file isn't created.

... but, looking at the header file I found the following line rather
> Content-Encoding: gzip
> Vary: User-Agent, User-Agent, User-Agent, User-Agent
> Accept-Ranges: byte

- I've no occurrence of Vary either in /var/www nor in /etc/apache2
- searching google retrieved a couple of similar results of this Vary: string

The origin is probably the BrowserMatch directive which, by default are
enabled in Debian's mods-available/setenvif.conf.
(and mod_ssl depends upon mod_setenvif)

This is how I realized that the cache coupled to setenvif in it's
default configuration was *very* inefficient (disk-space).
`Vary: User-Agent` is something we would rather avoid given the
ridiculously huge number of combination for this string nowadays.
>From the last quick grep' I had 325 of them what could reduce my cache's
size to a dozens of MB and increase proportionally it's efficiency.

First, not really a question, but a couple of suggestions:
- BrowserMatch should not blindly add to the Vary header but
  addifnotexist (it's part of the mod_headers possibility in Apache 2.4
  series isn't?)
- mod_cache_disk documentation could state whether this duplication hurts or not
- the default setenvif.conf may avoid use of "exotic"/"rare" default
  BrowserMatch directives in case of <IfModule mod_cache.c>

... but then, following the objective to avoid a Vary: User-Agent, I
found that I had two other BrowserMatch in default-ssl.conf.
The second one about MSIE 7 to 10, in order to set ssl-unclean-shutdown.
- I didn't find where is documented what this variable does internally
- I guess this variable only affects mod_ssl behavior but nothing about
  request header/data
If the above is right, then is it pertinent with discard^W Vary:
User-Agent if the content can't change according to the User-Agent.
Maybe BrowserMatch could be more flexible about that.

Anyway, I commented these two mod_ssl BrowserMatch directives (in case I
would not care about broken? MSIE behaviors), but I'm still Vary'ing:

I commented the ultimate SetEnvIfExpr my configuration contained
(unrelated to browsers anyway) and egrep -ri '(Browser|SetEnvIf)'
but still... Vary: User-Agent
didn't brought up another clear source for this.

Any hint about where this Vary's value could come from?

thank you

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message