You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Raphaël <ra...@gmail.com> on 2015/11/03 02:04:45 UTC

[users@httpd] Re: mod_cache_disk: how to avoid Vary: User-Agent?

Hi,

still related to the previous post, but put simply:
I'd just appreciate to learn how to keep Apache from automatically
adding "User-Agent" to the "Vary" header.


thank you in advance



On Thu, Oct 22, 2015 at 11:51:31PM -0300, Raphaël Droz wrote:
> I recently received a dozens of AH00708: errors in my logs.
> Example:
> > (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/bK@34Pw3MJOqHRZda2kQ.data
> 
> 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
> strange:
> [...]
> > 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:
> User-Agent.
> 
> I commented the ultimate SetEnvIfExpr my configuration contained
> (unrelated to browsers anyway) and egrep -ri '(Browser|SetEnvIf)'
> but still... Vary: User-Agent
> https://github.com/apache/httpd/search?l=c&q=User-Agent&type=Code&utf8=%E2%9C%93
> didn't brought up another clear source for this.
> 
> Any hint about where this Vary's value could come from?
> 
> 
> thank you
> 

-- 
GPG id: 0xF41572CEBD4218F4

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: avoid Vary: User-Agent when ?

Posted by Raphaël <ra...@gmail.com>.
On Sun, Nov 08, 2015 at 12:04:33AM -0300, Raphaël wrote:
> This line:
> > <If "%{HTTP_USER_AGENT} == 'munin'>
> obviously caused the `Vary:` HTTP header to contain "User-Agent".
> 
> I still have to find how to keep the "new" syntax without the cost of
> the header modification.

which is clearly stated in the documentation. Thus:
> <If "req_novary('User-Agent') == 'munin'">

end of the story, sorry for the noise.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: avoid Vary: User-Agent when ?

Posted by Raphaël <ra...@gmail.com>.
On Mon, Nov 02, 2015 at 10:04:45PM -0300, Raphaël wrote:
> Hi,
> 
> still related to the previous post, but put simply:
> I'd just appreciate to learn how to keep Apache from automatically
> adding "User-Agent" to the "Vary" header.

This was an user error:

This line:
> <If "%{HTTP_USER_AGENT} == 'munin'>
obviously caused the `Vary:` HTTP header to contain "User-Agent".

I still have to find how to keep the "new" syntax without the cost of
the header modification.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org