On an Nginx install using WordPress with the Jetpack plugin, it has the ability to use domainname.com/?random to redirect to a random blog post.
The problem is that this page is getting cached and after visiting the random link once. It will not randomly redirect anymore - you simply get the same page as the first time random was clicked.
To remedy this, I tried:
location = /\?random {
expires -1;
}
and other variations like:
if ($arg_random){
expires -1;
}
Those don't seem to obey the rules.
I'm grateful for any help. Thanks.
Inspired by Michael Hampton's comment, I dug deeper.
It made me realize that W3 Total Cache is probably to blame for caching ?random links on a per-user basis.
In the W3TC plugin's settings I added "?random" (no quotes) to the "Cache exception list" on the Page Cache setting page (/wp-admin/admin.php?page=w3tc_pgcache)
Thanks for the great question which led to mer discovering the answer, Michael.