-
Notifications
You must be signed in to change notification settings - Fork 247
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
Varnish won't work because cache-control is being sent as nocache #275
Comments
where are you seeing the nocache header? I use this setup with varnish and it works really well |
I mean where are you seeing the header no-cache being set on nginx config? |
I'm not sure, I'm using this config mostly out of the box, but I have no idea what the cause/origin is! |
Probably not, I search on the repo for no-cache and haven't found. I saw that you have cookie on your request, is it the session? If so keep in mind that the drupal page cache doesn't work for logged in users and drupal always send no-cache in this case. If you are testing as anonymous user and still having the problem with no-cache there it's being set in another place. |
Hmm, it is odd. And no, it's the same for anonymous users. I guess it's somewhere else but I'm not sure where, perhaps it's just my Varnish config that's screwed, even though I used (again) an out-of-the box example from, I think d.org |
The no-cache for anonymous make totally sense since the website have different behaviours per user. Probably it's something on your varnish config, or also in the drupal cache configuration. Take a look into this varnish vcl file, it should work fine. https://github.com/Lullabot/varnish |
Thanks. I actually turned Varnish off completely and am still getting no-cache coming up. I also have this constant bug with microcaching being used when logged in, and on admin pages, so that the admin pages get stuck in a loop (for example, running cron does nothing first time, takes about 5 attempts... or saving a page will show the drupal_set_message for seconds before it disappears again) |
I just created a completely blank, vanilla D7 site. Turned off all Varnish and Redis and the like, and the headers still come back with
|
Okay, small update, I found what was doing it. If you look in
... so as stated, it seems to be using microcaching. But why? It completely overwrites the caching settings in Drupal, which I think is really bad. Especially if it's not made obvious where this is coming from or how it's working! Uncommenting those lines has made http://www.isvarnishworking.com/ go from "sort of" to "yes", due to now having an age > 0 So, this thread is maybe more of a discussion? Is this the right behaviour? |
There's also still the weird bug with caching on admin pages. Now, the headers coming from Drupal are working perfectly |
doesn't make sense have Microcaching if you have a varnish in front of it. I think the config of microcaching make sense only when you don't have an http cache layer... In my infra I don't use microcaching, just a reverse proxy and drupal cache |
I may be missing something, but the config seems to force main pages on Drupal to send a
Cache-Control: nocache
header, which stops Varnish from doing its thang. I am aware that microcaching is used, but should it not also respect the drupal cache settings?Thanks
The text was updated successfully, but these errors were encountered: