Skip to content

[6.x] Fix static cache invalidation rules for multisite with relative site URLs - #15493

Merged
jasonvarga merged 2 commits into
6.xfrom
fix/static-cache-relative-site-invalidation
Sep 21, 2026
Merged

jasonvarga merged 2 commits into
6.xfrom
fix/static-cache-relative-site-invalidation

Conversation

@joshuablum

@joshuablum joshuablum commented Sep 21, 2026

Copy link
Copy Markdown
Member

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 to getBaseUrl(), which is app.url plus 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 on APP_URL becomes https://example.com//de/*, which never matches either.

The fix

  • Prefix relative rules with $site->absoluteUrl(), matching how entry URLs are already resolved.
  • Run URL::tidy() over absolute rules too.
  • Replace the nine copies of the rule-to-URL logic with a single resolveRuleUrls() helper.
  • Preserve the final * when tidying wildcard rules so trailing-slash enforcement doesn’t break invalidation or background refresh.

@edalzell

Copy link
Copy Markdown
Contributor

@joshuablum does this close this #3291 ?

@jasonvarga
jasonvarga merged commit e0f79f7 into 6.x Sep 21, 2026
124 of 183 checks passed
@jasonvarga
jasonvarga deleted the fix/static-cache-relative-site-invalidation branch September 21, 2026 20:59
@joshuablum

Copy link
Copy Markdown
Member Author

@edalzell Maybe? Issue popped up through a support ticket. Will take a look tomorrow 👍

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.

3 participants