wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
698 stars 216 forks source link

The cache of URLs with query strings is not cleared when permalinks don't have a trailing slash #491

Open foliovision opened 7 years ago

foliovision commented 7 years ago

We use Advanced -> Cache query strings to cache some URLs with query strings. I enter "test" into that and then not only https://foliovision.com/2017/05/improved-video-loading-code is cached, but also https://foliovision.com/2017/05/improved-video-loading-code?test=1

Problem is that when I update the post the cache for https://foliovision.com/2017/05/improved-video-loading-code is cleared, but for https://foliovision.com/2017/05/improved-video-loading-code?test=1 it's not cleared.

Clearly a bug. Please check our pull request: #490

foliovision commented 7 years ago

Update: notice that in the pull request I added $permalink.'?* for purging.

However that ?* is later removed in rocket_clean_files filter by rocket_clean_files_users() - what is the purpose of that function?

Thanks! Martin

remyperona commented 7 years ago

I tested the issue on our test installation, and I can't replicate.

When updating the post, the caches for both the default version and the query string are correctly cleared.

Please test on a clean installation. If you're having this issue on this particular website, you can open a support ticket to understand why it's happening in this case.

GeekPress commented 4 years ago

Hi @foliovision 🤚

We haven't back from you since @Tabrisrp asked you a question, so I'm closing this issue. However, if you still need our help, just reply here and we will re-open the issue.

Best

vmanthos commented 2 years ago

I'm reopening this one as I found the conditions under which this issue occurs.

To reproduce:

  1. Permalink settings: remove the trailing /

  2. Add location in the Advanced Rules tab > Cache Query String(s) .

Visiting https://example.com/hello-world

the cache is created in /cache/wp-rocket/example.com/hello-world/.

Visiting:

That is NOT in a subfolder of the main /hello-world/ post. When clearing the cache of /hello-world/ the cache of the other folders isn't cleared.

The following is happening when permalink settings have a trailing /:

Visiting:

the cache is created respectively in:

/cache/wp-rocket/example.com/hello-world/#location=Athens
/cache/wp-rocket/example.com/hello-world/#location=Thessaloniki

That is in subfolders of the main post.

When clearing the cache of /hello-world/ the cache of all query-strings-related cached files is cleared as well.

WP Rocket should behave consistently regardless of the permalinks settings. Based on the fact that cache clearing doesn't work in the first case, I'd say that the second case, i.e. always storing the cache of query strings in subfodlers of the main post, is the way to go.

Update: The issue has been described here as well: https://github.com/wp-media/wp-rocket/issues/1392#issuecomment-504426647

piotrbak commented 3 months ago

This is not something that can be implemented in the nearest future. We might reopen this in the future.

Adrianadla commented 4 weeks ago

Hello! Seem a related case here: https://secure.helpscout.net/conversation/2715038814/513700/