-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for multiple backoffice hosts #18302
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small comments made in passing just as I was interested to read through.... I haven't tested.
src/Umbraco.Cms.Api.Management/Security/BackOfficeApplicationManager.cs
Outdated
Show resolved
Hide resolved
…anager.cs Co-authored-by: Andy Butland <[email protected]>
@DanielToft you may want to add your perspectives on this PR. No requirements for sure, but if you have the time you may want to test if this resolves your case? If your new to working with the Source Code then read this article. My idea was to build a local version of this branch and verify with a test project, nothing at stake, and verify if this works for you. https://github.com/umbraco/Umbraco-CMS/blob/contrib/.github/BUILD.md Thanks in advance |
@kjac Without having looked into the code too much, can you outline a bit more how it works regarding authorization if you do not set the
|
Yep 👍
They're always taken into account; if not explicitly defined, the defaults are applied: |
Thanks, @kjac. With this in place, we can simplify the authorization flow when working locally where we now do not have to set the BackOfficeHost setting. However, we still need to set the other settings, if we do not use the Before: "BackOfficeHost": "http://localhost:5173",
"AuthorizeCallbackPathName": "/oauth_complete",
"AuthorizeCallbackLogoutPathName": "/logout",
"AuthorizeCallbackErrorPathName": "/error" After: "AuthorizeCallbackPathName": "/oauth_complete",
"AuthorizeCallbackLogoutPathName": "/logout",
"AuthorizeCallbackErrorPathName": "/error" I wonder what your thoughts are on introducing a new setting that allows us to specify the backoffice subpath ( "BackOfficePath": "/umbraco" This is currently being controlled by a constant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm 🚀
Prerequisites
Description
It is currently not possible to have multiple backoffice hosts. This poses an issue for sites that require multiple hostnames providing access to the backoffice.
Here's a PR to fix 😄
Details
As-is, the first backoffice request "wins"; if I request my.host/umbraco, my.host becomes the allowed backoffice host. If I subsequently request my-other.host/umbraco (provided both hostnames point to the same Umbraco instance), I will be met with a somewhat unfriendly message stating that it is not permitted.
This is all because we need to explicitly configure hosts as allowed for redirection in OpenId Connect (via OpenIddict).
With this PR, backoffice hosts are accumulated over time instead of the current "first in wins" strategy.
To retain backwards compatability, the
SecuritySettings.BackOfficeHost
takes precedence over any accumulated backoffice hosts (if configured).Testing this PR
Fire up Umbraco on multiple ports (use
launchSettings.json
) and verify that you can access Umbraco on all ports.While you're at it, also verify that the corresponding localtest.me:[port]/umbraco work.
Using a debugger, verify that
WebRoutingSettings.UmbracoApplicationUrl
is always applied as allowed backoffice host (if configured).Lastly, verify that
SecuritySettings.BackOfficeHost
(when configured) takes precedence over both the accumulated hosts andWebRoutingSettings.UmbracoApplicationUrl
.