How to Avoid ERR_TOO_MANY_REDIRECTS in the case of Azure CDN(http-to-https redirect rule)

Chris Edward Rego
3 min readSep 5, 2019

--

ERR_TOO_MANY_REDIRECTS on Chrome Browser.
ERR_TOO_MANY_REDIRECTS on Chrome Browser.

After spending couple of hours researching and applying Azure CDN Rules for http-to-https redirect rule, which takes another 4 long hours for the changes to propagate ,and even longer if thinks it should.. After waiting for couple of hours all that i was greeted was this beautiful error message ERR_TOO_MANY_REDIRECTS.

A quick search made me understand what this error message actually meant…

ERR_TO_MANY_REDIRECTS aka Infinite loop, in this case the website keeps redirect you over and over again and again, until it finally gets exhausted an greats you with the above error message.

(Starting of with some Client side troubleshooting steps to fix this issue…)

  1. Clear the Browsing Cookies/Cache.
  2. Tried Incognito Mode/In-Private Browsing.
  3. Trying with a different browser.
  4. Verified if my system date was not outdated.
  5. Trying to access the same application on different device on different Network (Mobile).

“We cannot solve our problems with the same thinking we used when we created them” — Albert Einstein

Trying to shift the approach towards this issue, i finally tried to cross-check if the Azure CDN rules that was configured, was it even right? So quickly logged into azure Portal

  1. Head-over to the CDN Profile (Click on Manage)

2. Click on Rules Engine to configure the rules.

3. Changed the Condition from Always to Request Scheme

In this case, the Request Scheme was set to always which made the website spin in infinite loops irrespective of the protocol that was used to access the website which could have been http or https.

4. Adding the Final Touch (Request Scheme) + (http)

In this case, we check that if the Request Scheme is http, if thats true, then go ahead and redirect it to https, After reapplying the above rule , it took much lesser time than expected and i was able to access the website without any issue.

XML for the http-to-https-redirect:

<rules schema-version=”2" rulesetversion=”1" rulesetid=”XXX" xmlns=”http://www.whitecdn.com/schemas/rules/2.0/rulesSchema.xsd">
<rule id=”2298147" platform=”http-large” status=”active” version=”X" custid=”XXXX">
<description>http-to-https-redirect</description>
<! — If →
<match.request-scheme value=”http”>
<feature.url-redirect code=”301" pattern=”/XXXXX/testop/origin_cdn_endpoint/(.*)” value=”https://%{host}/$1" />
</match.request-scheme>
</rule>
</rules>

Conclusion

Hope this helps!!

Did I miss anything that you may think which is needed? I hope you liked my first article. Please share me your valuable suggestions and feedback.

--

--