Simplify the module by removing unnecessary and conflicting logic

Created on 31 August 2016, about 8 years ago
Updated 12 July 2023, over 1 year ago

I am working on a complex setup including Authenticated User Page Caching (Authcache) , Ubercart with both anonymous and authenticated users and sessions.

Of course, I'd like to use this module because of the purge and expire cache integration, but I think some design decisions of the module are creating more issues that the one that attempts to solves.

At first, I think hook_exit should work better than hook_init even with the code as it is, because other modules could possible invalidate the cache of page, and right now I found places where a page was supposedly not to be cached, but because the surrogate control header was sent very early in the drupal page serving cycle, it was cached anyway.

On the other hand, with the changes I am proposing, I don't think it makes no difference whether the code is on hook_init or hook_exit() and as pointed below, hook_init, for that key, is better.

Drupal 7 is definitely not the best prepared suite for CDN/reverse proxy. For starter it sends Vary: Cookie which pretty much invalidates any properly setup reverse proxy that's rely on the Vary header.

However, there are good cache alternatives and with proper configuration you can have a nicely cache site both internally and properly serve to reverse proxy. All of those modules, work properly with the Cache-control tag and drupal internal cache mechanisms.

The use of the Surrogate-control, is a little bit absolute and it doesn't honour other caching solutions that could have affected Cache-control in different ways, because Surrogate-Control takes preference. I found places were a page was not supposed to be cached, but because of surrogate control it was.

I think a logic behind surrogate-control is behind the purpose of this module, that should be up to the developer, and if anything, it should be on its own module, providing a proper configurable logic for alternatives.

I am proposing the following changes:
- remove the ttl configuration
- remove the configuration for excluding pages
- remove the surrogate-control header
- remove the Vary setting

With this changes, the becomes more simplistic, it only really integrates with fastly, provides the Surrogate-Key, which is a nice addition, but you still need to work out your own cache solutions.

I strongly recommend looking at authcache, and also at https://www.drupal.org/sandbox/hanoii/2786375 which I will soon release and is working nicely with fastly.

🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇦🇷Argentina hanoii 🇦🇷UTC-3

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024