APO breaks the Page Rule work (cache everything matched query param)

Hi there!

I am running a simple AJAX app with pagination to allow visitors to view posts teasers. And I need to cache AJAX requests which contain custom query string parameters. So that my request URL is looking similar to “https://mysite.com/wp-admin/admin-ajax.php?action=get_posts&query[paged]=2

To achieve caching of such dynamic content I have set my page rule like this “https://mysite.com/wp-admin/admin-ajax.php?action=get_posts*”. Additionally I have set “Cache Level: Cache Everything” as the only setting for that rule.

As you can see I added the asterix at the end of the rule to include any additional query string parameters in a cache key. Everything works as expected and the pagination works well.

Then I enabled APO, cleared the whole cache and things got broken. Now requests with query strings return the same cached response regardless of the additional passed query string parameters(I mean “query[paged]=”).

So either of these request URLs will always return the same response:
the same as if I run “https://mysite.com/wp-admin/admin-ajax.php?action=get_posts” without “&query[paged]=2” part. It looks like any other query string parameters are ignored.

When I disable my page rule then pagination does work well again but it’s not cached.

Is it possible to have APO working with “Cache Everything Page Rule” and have additional query strings to be included into the cache key so that pagination on my app will work and responses will be cached?

P.S. I use Standard Caching Level.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.