[6.x] Fix static cache invalidation rules for multisite with relative site URLs - #15493
Merged
Merged
Conversation
Contributor
|
@joshuablum does this close this #3291 ? |
Member
Author
|
@edalzell Maybe? Issue popped up through a support ticket. Will take a look tomorrow 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes static cache invalidation rules silently doing nothing on multisites whose site URLs are relative (e.g.
/de/,/fr/).Relative invalidation rules were prefixed with
$site->url(), producing relative URLs like/de/*. Since there's no domain, the cacher falls back togetBaseUrl(), which isapp.urlplus the current site's path (https://example.com/de). Cached URLs are stored under the host only (https://example.com), so the lookup hits an empty bucket and nothing is invalidated.Entries mask this because their own
absoluteUrl()is always invalidated. Navigations, globals, forms, assets, etc. rely entirely on rules, so they appear broken.Separately, absolute rules weren't tidied. A rule like
env('APP_URL').'/de/*'with a trailing slash onAPP_URLbecomeshttps://example.com//de/*, which never matches either.The fix
$site->absoluteUrl(), matching how entry URLs are already resolved.URL::tidy()over absolute rules too.resolveRuleUrls()helper.