Skip to content

[6.x] Fix static cache invalidation stripping trailing slashes#14713

Open
duncanmcclean wants to merge 1 commit into
6.xfrom
fix/static-cache-trailing-slashes
Open

[6.x] Fix static cache invalidation stripping trailing slashes#14713
duncanmcclean wants to merge 1 commit into
6.xfrom
fix/static-cache-trailing-slashes

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

This pull request fixes an issue where static cache invalidation rules fail to clear the cache when trailing slash enforcement is enabled via URL::enforceTrailingSlashes().

This was happening because the DefaultInvalidator was explicitly calling URL::tidy() with withTrailingSlash: false, which stripped trailing slashes regardless of the global setting. This caused a mismatch: the URL index stores paths with trailing slashes (e.g., /events/) but the invalidator was generating paths without them (e.g., /events), causing exact-match lookups to fail.

This PR fixes it by removing the explicit withTrailingSlash: false argument from all URL::tidy() calls, allowing them to respect the global trailing slash setting. This is consistent with how DefaultUrlExcluder already handles URL normalization.

Fixes #14701

When trailing slash enforcement is enabled via `URL::enforceTrailingSlashes()`,
custom invalidation rules were failing to clear the cache because the invalidator
was explicitly stripping trailing slashes with `withTrailingSlash: false`.

This caused a mismatch: the URL index stores paths with trailing slashes
(e.g., `/events/`) but the invalidator was generating paths without them
(e.g., `/events`), causing exact-match lookups to fail.

The fix removes the explicit `withTrailingSlash: false` argument from all
`URL::tidy()` calls, allowing them to respect the global trailing slash setting.

Fixes #14701

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static cache invalidation strips trailing slashes from rules

1 participant