You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
@oschaaf thanks, I applied the patch successfully (without errors) and recompiled Nginx with it.
Unfortunately, still the issue.
The double Vary headers appear after accessing the URL for the 2nd time.
Just try it yourself, change qver=1.11.4 to qver=1.11.5 or 6 or what you want, it's just a variable. The double Vary headers appear after the 2nd access.
It's only with rewritten sources, normal sources are fine:
I've purged all the caches (pagespeed via memcached) and gave the whole VPS a reboot to make sure not battling with the caches, but still no avail. Let me know if you need more information.
It took me a little while, but I found the old directory where I could reproduce writing out three Vary:Accept-Encoding response headers.
Applying #1105 there, the number of Vary: Accept-Encoding headers goes down from three to two on the optimized IPRO and .pagespeed. responses for me.
The two remaining Vary: Accept-Encoding headers originate from PSOL in both cases, and it seems this duplication has already been fixed on mod_pagespeed's master. With #1105 applied and build against the current state of mps master I can't reproduce the problem: a single Vary: Accept-Encoding gets emitted every time.
What is surprising is that your website continues to emit three Vary:Accept-Encoding headers with #1105 applied: I would at least have expected one of them to be removed.. Which makes me wonder: how did you clear PageSpeed's caches? The "official" way or by directly purging the memcached instance(s)?
@oschaaf yes, strange isn't it? I cleared the cache by deleting the files inside /var/cache/ngx_pagespeed and I rebooted the server (so memcached would be 100% fresh and empty too).
There are no Wordpress cache plugins installed (except the nginx helper plugin). I also cleared the nginx fastcgi cache just to be sure, by clearing /var/run/nginx-cache.
@HansVanEijsden: Are you sure you fired up the patched nginx binary? Is it possible that the old (unpatched) nginx server was/is still running? I can't yet come up with a reason that would explain how it could be that the patch has zero effect, but there may be something in your configuration or module list that bars the patch from working correctly (though even if the patched worked, the problem would persist but in reduced form, because ngx_pagespeed would also need to be build against a newer PSOL version to eliminate the problem completely).
If you are sure we're looking at a patched nginx instance, what does nginx -V look like? Could you PM your configuration files?
Thanks @HansVanEijsden
I PM'd you another patch, let me know if that results in a single Vary: Accept-Encoding header being emitted consistently.
If it does, that means that #1105 is probably all we need for the nps side to resolve this.
I don't know if it's by purpose, but I receive Pingdom errors about Vary headers (I applied the patch), because sometimes there are 2 different Vary headers at the same time: "Vary: Accept-Encoding" and "Vary: User-Agent".
multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)].
It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma.
(This is after I merged #1105 but I didn't rebuild jefftk.com so that bug is still there.)
We see:
1st response: one vary header.
2nd response: four vary headers.
3rd and later requests: three vary headers.
The 1st response is correct, and for the later responses not having #1105 merged means one extra one is expected. So there's two unexplained vary headers on the 2nd response, and one unexplained on later responses.
Trying to fix this now.
(Thanks for @morlovich for having a good sense of where to look!)
Talking to @oschaaf , neither of us have been able to reproduce this with current PSOL, just on the 1.10 branch. It looks like this will be resolved the rest of the way when we next cut a branch (1.12 if it exists, otherwise 2.0) and it's not worth putting additional time into for now.
Sorry @centminmod , only half of this fix is in 1.11. Specifically, b081bb7 resolved this for most users, but for some users we have unreleased changes on master to clean up the rest of the duplication. That will be in 1.12 (if it's needed) or 2.0.
Activity
deweydb commentedon Dec 10, 2015
Not sure if related, but i was having this issue when i had: gzip_vary on; in my http block, instead of the server block.
oschaaf commentedon Dec 11, 2015
@jeffkaufman is this worthy of being on the work-prioritization list?
jeffkaufman commentedon Jan 5, 2016
Added
HansVanEijsden commentedon Jan 26, 2016
Reminder, please.. would love to have this fixed too (request of one of my clients). 😃
Niwreg commentedon Jan 26, 2016
Same issue here. I'll follow the thread in case of updates :)
oschaaf commentedon Jan 27, 2016
Fix for this is in progress at https://github.com/pagespeed/ngx_pagespeed/tree/oschaaf-trunk-tracking-issue-1064, working on tests to prevent regression.
I have yet to reproduce the situation again where we emit three
Vary: Accept-Encodingheaders which somehow seems hard now, but this fix gets rid of a reproducible doubleVary: Accept-Encodingsituation.If anyone is up for trying the patch, here it is: https://github.com/pagespeed/ngx_pagespeed/compare/trunk-tracking...oschaaf-trunk-tracking-issue-1064.patch
vary-header: Emit a single vary header in the IPRO flow
HansVanEijsden commentedon Jan 28, 2016
@oschaaf thanks, I applied the patch successfully (without errors) and recompiled Nginx with it.
Unfortunately, still the issue.
The double Vary headers appear after accessing the URL for the 2nd time.
First time:
Second time:
Just try it yourself, change qver=1.11.4 to qver=1.11.5 or 6 or what you want, it's just a variable. The double Vary headers appear after the 2nd access.
It's only with rewritten sources, normal sources are fine:
I've purged all the caches (pagespeed via memcached) and gave the whole VPS a reboot to make sure not battling with the caches, but still no avail. Let me know if you need more information.
oschaaf commentedon Jan 29, 2016
It took me a little while, but I found the old directory where I could reproduce writing out three
Vary:Accept-Encodingresponse headers.Applying #1105 there, the number of
Vary: Accept-Encodingheaders goes down from three to two on the optimized IPRO and .pagespeed. responses for me.The two remaining
Vary: Accept-Encodingheaders originate from PSOL in both cases, and it seems this duplication has already been fixed on mod_pagespeed's master. With #1105 applied and build against the current state of mps master I can't reproduce the problem: a singleVary: Accept-Encodinggets emitted every time.What is surprising is that your website continues to emit three Vary:Accept-Encoding headers with #1105 applied: I would at least have expected one of them to be removed.. Which makes me wonder: how did you clear PageSpeed's caches? The "official" way or by directly purging the memcached instance(s)?
HansVanEijsden commentedon Jan 29, 2016
@oschaaf yes, strange isn't it? I cleared the cache by deleting the files inside /var/cache/ngx_pagespeed and I rebooted the server (so memcached would be 100% fresh and empty too).
There are no Wordpress cache plugins installed (except the nginx helper plugin). I also cleared the nginx fastcgi cache just to be sure, by clearing /var/run/nginx-cache.
oschaaf commentedon Jan 29, 2016
@HansVanEijsden: Are you sure you fired up the patched nginx binary? Is it possible that the old (unpatched) nginx server was/is still running? I can't yet come up with a reason that would explain how it could be that the patch has zero effect, but there may be something in your configuration or module list that bars the patch from working correctly (though even if the patched worked, the problem would persist but in reduced form, because ngx_pagespeed would also need to be build against a newer PSOL version to eliminate the problem completely).
If you are sure we're looking at a patched nginx instance, what does
nginx -Vlook like? Could you PM your configuration files?HansVanEijsden commentedon Jan 30, 2016
@oschaaf unfortunately.. yes, I'm sure about that.
To be sure, I've done a complete re-install of ngx_pagespeed and nginx.
I installed ngx_pagespeed following the instructions in #1099 and I also applied the cherry-pick.
Then, I applied your patch:
After re-installing nginx I gave the whole server a reboot, to make really really sure no old binaries to be active.
Here's my nginx -V:
I sent you my config files by mail. 😃
oschaaf commentedon Jan 30, 2016
Thanks @HansVanEijsden
I PM'd you another patch, let me know if that results in a single
Vary: Accept-Encodingheader being emitted consistently.If it does, that means that #1105 is probably all we need for the nps side to resolve this.
HansVanEijsden commentedon Jan 30, 2016
@oschaaf I own you a beer.
The patch you PM'ed works! 😄 😄
bytes-crafter commentedon Feb 4, 2016
There are two
Vary: Accept-Encodingheaders after I applied #1105, how to make it a singleVary: Accept-Encoding?10 remaining items
HansVanEijsden commentedon Feb 19, 2016
I don't know if it's by purpose, but I receive Pingdom errors about Vary headers (I applied the patch), because sometimes there are 2 different Vary headers at the same time: "Vary: Accept-Encoding" and "Vary: User-Agent".
Turning Pagespeed off fixes it:
The correct one would be: "Vary: Accept-Encoding, User-Agent".
oschaaf commentedon Feb 19, 2016
@HansVanEijsden As far as I know at the http level
means the same as
From https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
HansVanEijsden commentedon Feb 19, 2016
@oschaaf thanks! I will pass that on to Pingdom.
deweydb commentedon Mar 4, 2016
Sorry for the super noob question but how do i apply this patch without it failing?
HansVanEijsden commentedon Mar 4, 2016
@deweydb no worries, there are no stupid questions, only stupid answers.
I do it like this:
First I go to the source folder (cd ngx_pagespeed-release-1.10.33.6-beta) and then I download the patch there (wget https://gist.githubusercontent.com/oschaaf/c16c7458a57db4e94323/raw/a659f3809b22a89b49cd647d5466ab8f8fa66dad/multiple-vary-hans-hotfix.patch).
Then I apply the patch (patch -p1 < multiple-vary-hans-hotfix.patch).
Good luck!
[-]Multiple Vary headers emitted?[/-][+]Multiple Vary headers emitted[/+]jeffkaufman commentedon Mar 8, 2016
I just reproduced this on www.jefftk.com:
And then:
(This is after I merged #1105 but I didn't rebuild jefftk.com so that bug is still there.)
We see:
1st response: one vary header.
2nd response: four vary headers.
3rd and later requests: three vary headers.
The 1st response is correct, and for the later responses not having #1105 merged means one extra one is expected. So there's two unexplained vary headers on the 2nd response, and one unexplained on later responses.
Trying to fix this now.
(Thanks for @morlovich for having a good sense of where to look!)
jeffkaufman commentedon Mar 8, 2016
Even though I have this replicated on jefftk.com, I'm still having trouble replicating it in a dev environment. Still working on it.
jeffkaufman commentedon Mar 8, 2016
Talking to @oschaaf , neither of us have been able to reproduce this with current PSOL, just on the 1.10 branch. It looks like this will be resolved the rest of the way when we next cut a branch (1.12 if it exists, otherwise 2.0) and it's not worth putting additional time into for now.
vary-header: Emit a single vary header in the IPRO flow
vary-header: Emit a single vary header in the IPRO flow
centminmod commentedon Apr 1, 2016
I thought this was fixed in 1.11.33.0 ?
from proxy downstream front end
from proxy downstream backend
nginx configuration
jeffkaufman commentedon Apr 4, 2016
Sorry @centminmod , only half of this fix is in 1.11. Specifically, b081bb7 resolved this for most users, but for some users we have unreleased changes on master to clean up the rest of the duplication. That will be in 1.12 (if it's needed) or 2.0.
centminmod commentedon Apr 5, 2016
@jeffkaufman thanks for the clarification.. looking forward to 1.12/2.0 :)