Hi,

Thanks for creating this module, it works great at first sight!!

However when trying to warm the cache I found out that Drupal sets the vary header like this by default:

Accept-Encoding,User-Agent,Cookie

Unfortunately the User-Agent vary is a large disadvantage as far as I can see, it makes many copies of the same content, while the output of the HTML isn't any different usually for different browsers? Different mobile versions aren't solved anymore by changing html nowadays.

1. Why does Drupal has this default behavior and how are others coping with this regarding varnish cache? Many pages aren't cached since many many user agents exists. It even prevents the cache warming process.

2. Wouldn't it be great if you would add a setting to influence the vary header? Drupal already has built-in functionality to disable the Vary for the Cookie. Why not add a bypass in your module for User-Agent?

Temporary fixed by modifying the vcl_recv:

unset req.http.User-Agent;

But built-in support would be a lot nicer, so the site itself influences the behavior.

Please let me know what I'm perhaps overlooking here!

Comments

hostedpower created an issue. See original summary.

hostedpower’s picture

Issue summary: View changes
hostedpower’s picture

Issue summary: View changes
miritas’s picture

Hi,

I do agree with you that the presence of User-Agent in the Vary header reduces cache efficiency.

Probably I missed something, but I've checked a few Drupal sites and there is no User-Agent in the Vary header. Also, I've done a quick search across the code and didn't find anything that could bring to such behavior.

Thus, before moving on with a possible solution I'd like to ask you to review your site and try to determine where User-Agent comes from. Can you try to do it?

This information will help to develop a proper solution that will be useful for everyone.

Regards.

hostedpower’s picture

Yes that's quite funny, I already searched Drupal source code and I couldn't find it either!

However yesterday we discovered some legacy setting in .htaccess for gzip which introduced that Vary for User Agent! :)

So the problem was that htaccess rule which was quite hidden somewhere.

That's pretty good news there is no Vary for User-Agent.

I think issue is resolved, thanks a lot for your feedback!! :)

miritas’s picture

Status: Active » Closed (works as designed)

I am happy to know that you solved your issue.