EtchUK/Etch.OrchardCore.SEO

Hostname redirect causes ERR_TOO_MANY_REDIRECTS when a URL includes an encoded space

Closed this issue · 0 comments

When the hostname redirect feature is enabled, the browser encounters an ERR_TOO_MANY_REDIRECTS if the URL include an encoded space (%20). Spaces within a URL are probably pretty rare under normal circumstances, but the Orchard Core media library allows site admins to create their own folder structure and rename images, this means naming best practices cannot be assumed.

I found the issue in RewriteOptionsService.ApplyRule, when the requested url and the consistentRequestUrl are being compared. The requested url encodes spaces, but the consistentRequestUrl does not, leading to a redirect loop.

image