In Chrome, how many redirects are "too many"?

Google ChromeWebkit

Google Chrome Problem Overview


Often, when a script has a redirect loop we get an error in Google Chrome that says

> Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

How many redirects are too many?

Google Chrome Solutions


Solution 1 - Google Chrome

Google Chrome 17.0.963.56 allows a maximum of 20 redirects, as tested with this PHP script:

<?php
    $redirect = (isset($_GET['redirect'])) ? $_GET['redirect'] : 0;
    header("Location: redirects.php?redirect=" . ($redirect + 1));
?>

Chrome aborts with error 310 when trying to open redirects.php?redirect=21, which means that the first 20 redirects were successful.

Solution 2 - Google Chrome

Tested on Win 7 64bit

  • Chrome 64bit Version: 49 80.0.3987.132 (Official Build), 19 redirects
  • Chrome Canary 64bit, Version: 49 88.0.4306.2 (Official Build), 19 redirects
  • Firefox 32-bit version: 43 74, 20 redirects
  • Firefox 64-bit version: 43 74, 20 redirects
    • Firefox 64-bit 67.0.4, endless loop!
  • Opera version: 28, 65.0.3467.62 19 redirects
  • Safari version: 5.1.7, 16 redirects
  • IE version: 8 11 redirects via webpagetest.org
  • IE version: 9 121 redirects via webpagetest.org
  • IE version: 10 121 redirects via webpagetest.org
  • IE version: 11.48.17134.0 110 redirects
  • Microsoft Edge version: 42.17134.1.0 20 redirects
  • Google Nexus 5, Samsung Galaxy S4 ⇄ S9, Galaxy Tab 4, 19 redirects


Solution 3 - Google Chrome

Chrome and Firefox out of the box is 20, Internet Explorer is 10, I couldn't tell you on Opera or Safari

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTarangView Question on Stackoverflow
Solution 1 - Google ChromeDennisView Answer on Stackoverflow
Solution 2 - Google ChromePanos Kal.View Answer on Stackoverflow
Solution 3 - Google ChromeAnthony ShawView Answer on Stackoverflow