Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Override max-age directive from WP SuperCache #102

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

In a recent change, Autoptimizer has stopped overriding WP SuperCache's max-age directive. My guess is that was unintended, but of course I'm not sure what lead to this change.

In this commit the Header set Cache-Control that set the max-age to a lengthier timeframe was removed (seemingly in favour of the ExpiresByTime), then in another commit a Header append Cache-Control was added without the max-age directive. This means that now WP SuperCache's max-age – which is set quite liberally – is now affecting Autoptimize's combined CSS files.

Since we're later setting Expires anyway, changing this to Header set Cache-Control "public, immutable" would remove WP SuperCache's max-age and let the Expires headers take over.

I'm not sure if there's more to the initial changes than I'm able to see at the moment, so feel free to shut this down if that's the case.

@jessedyck jessedyck Override max-age directive from WP SuperCache
In a recent change, Autoptimizer has stopped overriding WP SuperCache's max-age directive. My guess is that was unintended, but of course I'm not sure what lead to this change. 

In (this commit)[aa76f54] the `Header set Cache-Control` that set the max-age to a lengthier timeframe was removed (seemingly in favour of the ExpiresByTime), then in (another commit)[0624503] a `Header append Cache-Control` was added without the max-age directive. This means that now WP SuperCache's max-age – which is set quite liberally – is now affecting Autoptimize's combined CSS files.

Since we're later setting `Expires` anyway, changing this to `Header set Cache-Control "public, immutable"` would remove WP SuperCache's max-age and let the `Expires` headers take over. 

I'm not sure if there's more to the initial changes than I'm able to see at the moment, so feel free to shut this down if that's the case.
ac00fc1
Owner

futtta commented Jul 17, 2017

first off; I can't reproduce this, but this might depend on the mode WPSC is run in (I'm on legacy PHP).

the problem with your solution is that as the mod_expires block already sets cache-control, header set removes/ overrides that (as reported by @pothi), hence my use of header update.

couldn't we do
header merge cache-control "public, immutable, max-age: 10672000"

or will we have to go down the header edit path?

Owner

futtta commented Jul 24, 2017

I'm going to close this PR @jessedyck

  • I haven't been able to reproduce
  • your header set would overwrite cache-control set by mod_expires which was what we were trying to avoid
  • One workaround could be to disable "static delivery" in AO settings
  • Another another workaround could be to create your own htaccess "template" in wp-content/AO_htaccess_tmpl and the stock AO htaccess will not be used

have a nice day!
frank

@futtta futtta closed this Jul 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment