Geta / geta-notfoundhandler

The popular NotFound handler for ASP.NET Core and Optimizely, enabling better control over your 404 page in addition to allowing redirects for old URLs that no longer works.
Apache License 2.0
19 stars 16 forks source link

Issue: Relative URL without wildcard resulting in an infinite redirect #78

Open GeekInTheNorth opened 1 year ago

GeekInTheNorth commented 1 year ago

We have encountered an issue with relative redirects. A client has a people page which is organised like so:

/en/people/ (folder-page) /en/people/person-one/ /en/people/person-two/ /en/people/experts/

How to Reproduce:

Version: 5.0.5 Old Url: /en/people/ New Url: /en/people/experts Wildcard: false

Url Attempted: /en/people/fneksnfa Expected Result: 404 Actual Result: Infinite redirect with /expert/ repeatedly added to the URL

e.g. https://prod.client-name.com/en/people/experts//experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/experts/fneksnfa

Work Around: Enter these rules as absolute URLs

Would it be possible to define a behaviour rather than being wildcard on/off to be a behaviour choice:

For example, if we have a redirect: /a to /b, then:

Match All (existing wildcard on) : it will redirect /a/1 to /b Partial Replace (existing wildcard off) : it will redirect /a/1 to /b/1 Exact Match: it will redirect /a to /b, /a/1 will remain as /a/1