How many redirects do browsers follow (updated 2015-04-07)
Date: 16 Dec 2012Author: Erik Dubbelboer
Today I was wondering how many 302 redirects browsers would follow before stopping. There are some posts about this but I couldn’t find a source which was up to date and included all browsers. So I decided to make my own:
Browser | Redirects |
---|---|
Firefox 6 - 37 | 20 |
Chrome 22 - 23 | 20 |
Chrome 41 | 20 but will automatically retry after a couple of seconds |
Opera 12 | 20 |
Opera Next 29 | 20 |
Safari 6 - 8 | 16 |
IE 6 | 100 |
IE 7 | 10 |
IE 8 | 10 |
IE 9 - 11 | 110 |
And here’s the little nodejs script I used to test this.
var http = require('http');
http.createServer(function(request, response) {
var n = parseInt(request.url.substr(2));
if (isNaN(n)) {
n = 0;
}
console.log(n);
response.writeHead(302, {
'Location' : '?' + (n + 1),
'Cache-Control' : 'no-cache, must-revalidate',
'Expires' : -1,
'Connection' : 'close'
});
response.end();
}).listen(12345);