I am designing a web site, spread across many servers, and there are pages where I need up to chain up to 4 redirections in a row. I tried a few browsers (firefox, chrome, IE) and it seems to work fine.
Apparently, Firefox's default limit is 20 redirections in a row, Chrome's default seems to be 20, and IE8's limit seems to be 10 redirections.
What is the maximum number of HTTP redirections allowed by all major browsers? Is it 10?
Edit:
Why do I need 4 redirections? Basically, the user is in a hotspot, she tries to go to (say) google.com, there is a local captive portal that captures the request and redirects (#1) the user to a local server. The local server checks some things about the user, but if it does not have the data locally, it redirects (#2) the user to the central web site. If the user is already logged in to this central Web site, she gets redirected (#3) to another server (there are different portals depending on the user). Finally, the server checks the user's rights, and if she has the appropriate rights, there is a final (#4) redirection to the local access controller, in order to get access to the appropriate service. Believe me, I tried my best to remove redirections, but I cannot see where this can be optimized.
4 redirections should work in all major browsers. However, consider reducing the number to give users a faster experience. Each redirection requires a round trip between the user and the server (and requires creating a new connection, if it's redirecting to a different server). In total, the latency will be significant, likely annoying your users.
I also curious about this, but doesn't find info about what is the maximum number of redirection of each browser. So I try to test it by myself using this PHP code to each web browser that I have:
<?php
$count = $_GET["c"] ?? 0;
$next = $count+1;
header('Location:'.$_SERVER['PHP_SELF'].'?c='.$next);
exit;
The result is:
But I can not test IE/Edge because I don't have a windows OS. As Microsoft Edge use Blink engine, so I think the maximum 19 too. You can test above code using your own server or this link(mine). The last URL query number until show ERR_TOO_MANY_REDIRECTS error is the maximum redirection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With