You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, on our product page, I have been experiencing issues on mobile. Anytime a state is selected within the filters, it fails to update properly until I clear the cache.
I have been working with Pantheon Support to fix this issue, but the code snippets they provided did not fix the issue (trying to just avoid caching on that particular page on mobile). They mentioned that the root cause of this issue stemmed from the following:
That page makes a request to admin-ajax.php with a WordPress nonce.
By default WordPress has those valid for 24 hours, and it looks like it comes from the page data:
<script type="text/javascript" id="theme-scripts-js-extra"> /* <![CDATA[ */ var urls = {"base":"https:\/\/spartansurfaces.com","theme":"https:\/\/spartansurfaces.com\/wp-content\/themes\/spartan-surfaces","ajax":"https:\/\/spartansurfaces.com\/wp-admin\/admin-ajax.php"}; var vars = {"nonce":"402d7ba92f"}; var info = []; /* ]]> */ </script>
And the page data there is cached for 7 days on the edge, so that nonce will become invalid. It's possible you're noticing this now as a month or two ago WordPress was updated to default to 7 days instead of the previous 10 minutes I believe.
There are a few options they mentioned to try and resolve:
Extend the nonce lifetime
Reduce that page's caching time
Utilize a different endpoint without a nonce
My first question is, if this was a recent wordpress update, is there any areas where we can adjust the pantheon caching plugin to account for this?
And if not, can someone assist me in trying options 1 or 3?
Code we tried:
if (is_page(4293) && wp_is_mobile()) { header('Cache-Control: no-cache, no-store, must-revalidate'); }
The text was updated successfully, but these errors were encountered:
Hello, on our product page, I have been experiencing issues on mobile. Anytime a state is selected within the filters, it fails to update properly until I clear the cache.
I have been working with Pantheon Support to fix this issue, but the code snippets they provided did not fix the issue (trying to just avoid caching on that particular page on mobile). They mentioned that the root cause of this issue stemmed from the following:
That page makes a request to admin-ajax.php with a WordPress nonce.
The request looks like:
https://spartansurfaces.com/wp-admin/admin-ajax.php?regions%5B%5D=arizona&mg_nonce=402d7ba92f&action=mg_filter_team
By default WordPress has those valid for 24 hours, and it looks like it comes from the page data:
<script type="text/javascript" id="theme-scripts-js-extra"> /* <![CDATA[ */ var urls = {"base":"https:\/\/spartansurfaces.com","theme":"https:\/\/spartansurfaces.com\/wp-content\/themes\/spartan-surfaces","ajax":"https:\/\/spartansurfaces.com\/wp-admin\/admin-ajax.php"}; var vars = {"nonce":"402d7ba92f"}; var info = []; /* ]]> */ </script>
And the page data there is cached for 7 days on the edge, so that nonce will become invalid. It's possible you're noticing this now as a month or two ago WordPress was updated to default to 7 days instead of the previous 10 minutes I believe.
There are a few options they mentioned to try and resolve:
My first question is, if this was a recent wordpress update, is there any areas where we can adjust the pantheon caching plugin to account for this?
And if not, can someone assist me in trying options 1 or 3?
Code we tried:
if (is_page(4293) && wp_is_mobile()) { header('Cache-Control: no-cache, no-store, must-revalidate'); }
The text was updated successfully, but these errors were encountered: