Our Sitecore application (v10.1.3
) is hosted on Sitecore Managed Cloud. The following is the reason for implementing redirection for page requests.
The website's original domain/URL was https://example-toy-store.com/.
Later, it was decided that the site should only be browsed by https://example.com/toy.
example.com
is a non-sitecore website hosted somewhere else and the vendor handling that domain has implemented a reverse proxy (RP)
solution.
We have added a virtual folder /toy
in the Sitecore application.
When the user browses https://example.com/toy/*, the RP implementation will fetch the content from https://example-toy-store.com/* and render on page, without changing the URL in browser.
At the Sitecore application side, we need to redirect the requests for https://example-toy-store.com/* to https://example.com/toy/*
When we added a redirection rule in Sitecore application's web.config, for the above old-to-new-site usecase, this resulted in an infinite loop situation.
And that is the reason, we had to handle this in code.
The logic is currently in the preProcessRequest
like this:
<sitecore>
<pipelines>
<preprocessRequest>
<processor role:require="Standalone or ContentDelivery" type="MySite.Foundation.Multisite.Pipelines.RedirectOldDomainRequest, MySite.Foundation.Multisite" patch:before="processor[@type='Sitecore.Pipelines.PreprocessRequest.IIS404Handler, Sitecore.Kernel']" />
</preprocessRequest>
</pipelines>
</sitecore>
The implementation works fine with the redirects but we have observed a huge number of 404 failure requests in the Azure App Insights.
Example GET /404
for https://www.example-toy-store.com/404?item=%2Fbattery&user=extranet%5CAnonymous&site=website
But the /battery
is a valid page item.
So, is the current redirection class placed in the correct pipeline or should it be moved to httpBeginRequest
instead.
Thank you
RedirectOldDomainRequest
processor in order to best suggest where that processor should be placed inside the httprequestbegin pipeline.