Skip to content
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

Revert Request.Path when using SiteRouting and no route is found #2099

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Einarsson
Copy link

Example:

You're using SiteRouting with a site defined under www.foo.com/en-us.

You also have controllers/endpoints under www.foo.com/en-us that isn't handled by Piranha. For example www.foo.com/en-us/bar.

When RoutingMiddleware gets the request it will find a matching site for www.foo.com/en-us/bar. It will then change the Request.Path to www.foo.com/bar. It will then proceed to try to find a Page in this site for the slug /bar. If it finds one, it will then add that Pages path to the route as intended.

However if it does not find a page. You would want Piranha to skip this request and pass it as-is to the underlying framework. But the path has been changed to www.foo.com/bar in a previous step when looking up the site.

In this case, I set the Request.Path back to the raw original path of the request, so that the request is skipped properly and forwarded to the underlying framework as www.foo.com/en-us/bar.

@Einarsson
Copy link
Author

@dotnet-policy-service agree

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