WordPress: bypass cache on querystring, does disabling this impacts somewhere? #1747
Replies: 2 comments
-
It is not ideal to completely ignore query string and have everything cached. At times, there could be things like search which could give stale results when cached due to scenarios where the query string is ignored. But that could be absolutely fine on some sites whereas not so much on other sites. This highly depends and varies from site to site. If there are only a few particular query strings that you wish to not bypass cache, like AMP pages, here's what can be done: if ($query_string != "") {
set $skip 1;
}
# Don't bypass if the query string contains "?amp=1"
if ( $arg_amp ) {
set $skip 0;
} Similarly, you could have rules for other things where you wish to not bypass the cache. Once, you have done the required edits to the nginx config do not forget to reload nginx: ee site reload <site-name> --nginx |
Beta Was this translation helpful? Give feedback.
-
Thanks for your suggestion. This works also where the amp querystring is just ?amp, right (without any value)? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I can see that one of the suggested parts of the nginx configuration file for WordPress running fastcgi cache have this directive:
I'm thinking to disable this because all links from Facebook automatically have a querystring, also the AMP pages have a querystring and all that pages would bypass the cache.
What do you think about this?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions