Skip to content
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

WPEngine integration clears varnish cache on each /nocache/ hit #11

Open
fluxism opened this issue Jan 12, 2021 · 0 comments
Open

WPEngine integration clears varnish cache on each /nocache/ hit #11

fluxism opened this issue Jan 12, 2021 · 0 comments

Comments

@fluxism
Copy link

fluxism commented Jan 12, 2021

The WPEngine integration appears to clear the page's varnish cache on each hit to a /nocache/ link, using the wp_criticalcss_nocache action. This was added in 69c7926

Since the Web Check Queue hits the /nocache/ links, isn't the varnish cache being cleared every time the web check is done, regardless of whether there's page change to pass to the API Queue?

Would it be beneficial to instead duplicate the modify_permalink() function from the Kinsta integration, and add a cache_bust query argument?

if ( wp_doing_cron() ) {
add_filter( 'wp_criticalcss_get_permalink', [ $this, 'modify_permalink' ] );
}
}

public function modify_permalink( $url ) {
$key = 'cache_bust_' . bin2hex( random_bytes( 5 ) );
return add_query_arg( $key, '1', $url );
}

Apologies if I'm missing the purpose of the cache clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant