Skip to content

Stop recommending @web for site URLs#15347

Merged
brandonkelly merged 2 commits into4.11from
feature/cms-1313-stop-defaulting-site-urls-to-web
Jul 13, 2024
Merged

Stop recommending @web for site URLs#15347
brandonkelly merged 2 commits into4.11from
feature/cms-1313-stop-defaulting-site-urls-to-web

Conversation

@brandonkelly
Copy link
Copy Markdown
Member

@brandonkelly brandonkelly commented Jul 13, 2024

Stop suggesting @web for the Base URL value on new sites, and actively warn against it for sites that already use it—even if it was set explicitly via the aliases config setting.

Setting @web explicitly avoids a cache poisoning vulnerability, but leads to other issues:

  • If Craft is accessed via multiple host names/webroots, it needs to be set dynamically based on the currently-requested URL, which adds a lot of complexity to the config.
  • If there are multiple sites and at least one has a Base URL that starts with @web (and if @web is being defined correctly, based on the currently-requested URL), then that site(s) will always be treated as a candidate for serving the request. Also, Craft won’t be able to generate accurate cross-site URLs.

So instead of defaulting site Base URLs to @web/, the setting is now auto-populated with an environment variable name based on the site name (e.g. Foo Bar$FOO_BAR_URL).

@linear
Copy link
Copy Markdown

linear Bot commented Jul 13, 2024

[ci skip]
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.

1 participant