Added configuration option UseStrictDomainMatching, which allows control over whether content is routed without a matching domain #19815
+207
−13
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.
Prerequisites
Addresses: #19010
Description
The linked issue describes two concerns, only only one of which I could replicate, and which is addressed in this PR.
I've used the following setup:
With these domains:
localhost:44339
localhost:44340
I've then configured Umbraco to launch with these URLs (in
Program.cs
):Navigating to the following pages gives these results:
https://localhost:44339/sample-page/
- renders pagehttps://localhost:44339/sample-page-2/
- renders pagehttps://localhost:44340/sample-page/
- renders pagehttps://localhost:44340/sample-page-2/
- returns 404https://localhost:44341/sample-page/
- renders page (from Site A).The issue is reporting two things:
So this PR addresses the second issue. I considered it would be breaking to change this behaviour, and are situations where the current behaviour is desired (not least, when no domains are configured), so have introduced a new configuration option:
This defaults to
false
, which keeps the current behaviour. When set totrue
, the page won't be routed if a domain is not found and attached to the request provided to the content finder.With that we get the following results:
https://localhost:44339/sample-page/
- renders pagehttps://localhost:44339/sample-page-2/
- renders pagehttps://localhost:44340/sample-page/
- renders pagehttps://localhost:44340/sample-page-2/
- returns 404https://localhost:44341/sample-page/
- returns 404Testing
Review and verify what's described above.