Skip to content

Ignore endpoint selection candidates with host attribute if request doesn't match the configured hosts#18820

Merged
Migaroez merged 1 commit intov13/devfrom
v13/bugfix/filter-endpoint-candidates-by-host
Apr 3, 2025
Merged

Ignore endpoint selection candidates with host attribute if request doesn't match the configured hosts#18820
Migaroez merged 1 commit intov13/devfrom
v13/bugfix/filter-endpoint-candidates-by-host

Conversation

@AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Mar 26, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Resolves: #16816

Description

I was able to replicate the reported issue with the provided setup. Digging in it seemed that the issue is in the set of candidates we get in our implementation of IEndpointSelectorPolicy (EagerMatcherPolicy). This receives a set of candidates that match the route - so in the scenario from the provided setup code we have two, one for the custom controller and one for Umbraco's default match by slug.

I perhaps would have expected that this set of candidates would already have filtered out the one provided by the attribute routed custom controllers, but it seems it doesn't - it's included as the configured route matches.

So I've added a check to ensure that if we have an attribute routed IVirtualPageController, we look for a HostAttribute and if found, that the configured hosts include the host from the current request.

Testing

Setup using the provided test project and verify that the page on site 2 that shouldn't be affected by the attribute routed custom controller renders it's content.

…if request doesn't match the configured hosts.
@AndyButland AndyButland requested a review from Migaroez March 26, 2025 09:08
@AndyButland AndyButland changed the title Verify endpoint selection candidates with host attribute are ignored if request doesn't match the configured hosts Ignore endpoint selection candidates with host attribute if request doesn't match the configured hosts Mar 26, 2025
@jcrittenden
Copy link

Can we get this reviewed?

Copy link
Contributor

@Migaroez Migaroez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👩‍🍳👌

@Migaroez Migaroez merged commit d60a2a2 into v13/dev Apr 3, 2025
19 of 20 checks passed
@Migaroez Migaroez deleted the v13/bugfix/filter-endpoint-candidates-by-host branch April 3, 2025 19:13
AndyButland added a commit that referenced this pull request Apr 4, 2025
…if request doesn't match the configured hosts. (#18820)
@AndyButland
Copy link
Contributor Author

Cherry-picked into release/13.8.0.

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