-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: BootstrapPageCacheTestCase failing in mod_proxy Apache environments #5126
Comments
If I put in following code right after the test we're discussing here...
The output of $foo is:
I also played with the The only thing that fixes that test on my dev is to subtract one second from $last_modified and send that as "If-Modified-Since". But then again I'm not sure if this is what the test should check for. |
Hi @indigoxela, this took me a while to wrap my head around. From the looks of things, Backdrop does not respect the
So the existing test seems to check that Backdrop behaves as coded, but not actually according to HTTP specification, which should also consider the situation of an It's possible that what is happening here is that newer versions of Apache (or a proxy in front of Apache) is correctly returning a So my interpretation here of how to solve this problem is:
|
I filed a PR at backdrop/backdrop#3665 that correctly implements the HTTP spec, which should make it so that the same response is returned regardless of whether a web server or reverse-proxy returns a |
@quicksketch many thanks for digging into this! I've left comments on your PR for further head scratching. 😉 EDIT: Oh, BTW, that sleep(5) before the tests seems unnecessary, or - to make sure all the requests don't happen within the same second - could get reduced to sleep(1). What do you think? |
Yes, I think this is a situation where we could reduce it down to 1 second. The key thing is that a minimum amount of time passes, since the HTTP headers are to a 1 second of accuracy. I added the delay back in backdrop/backdrop#1367, but I think you're right it doesn't need to be that long. |
FTR - from our related discussion in our Zulip chat:
Totally makes sense to me. One of the main differences in setup between mod_php and php-fpm is mod_proxy (with proxy_fcgi). |
I updated the PR at backdrop/backdrop#3665 with @hosef and @indigoxela's feedback. Could either of you take another look? Thanks! |
Tadaaa, tests are passing now with php-fpm (mod_proxy):
|
That great! Thanks @indigoxela! I'm feeling good about this PR now, but I think it's confused me so much I'd like another set of eyes to read through it. Anyone up for either testing again or rereading the code for accuracy? |
I think @indigoxela is best positioned to mark this RTBC but I did look at the code and comments and it seems fine now. |
@indigoxela I marked it RTBC based on your review and mine. |
Thanks folks! I was nervous about merging this for 1.19.3 (the security release) that came out Thursday, but with your approvals and that release out of the way, now is a good time to merge this. I merged backdrop/backdrop#3665 into 1.x and 1.19.x. Thanks! |
Related to #1478.
The test BootstrapPageCacheTestCase fails to 100% on my dev, to 100% in Github Actions, but only randomly with Zen.CI.
Before being able to fix it, I need some explanation for the following part of the existing test:
I simply don't get that, can anyone explain, please?
$last_modified
is the header (datetime) from a previous GET.Now, on this follow-up request, the header is provided, which I interpret as:
If the resource did not change since last request, please give me a "304", so I know it's still the same, otherwise give me "200".
BUT the expected response in that test is "200" - which would mean it has changed and the browser gets the new version. Huh?
And X-Backdrop-Cache should be a HIT (some more head scratching).
Official info from developer.mozilla.org:
Following that info I interpret this test as wrong by concept, no? Especially when looking at the other asserts in that test. Please enlighten me 😀
PR backdrop/backdrop#3665
The text was updated successfully, but these errors were encountered: