What's The Deal With Safari's 'Too Many Redirects' Message?
July 9, 2010 5:16 AM   Subscribe

What's the detail, exactly, with Safari's "...can’t open the page. Too many redirects occurred trying to open..." message? I'm getting a spate of them this week on the BBC News site. A post by Apple blames it on the site but doesn't go into specifics. (If the site has a problem, why don't other browsers refuse to open it? What's Safari doing differently?) Lots of stuff generally unhelpful elsewhere on the net. Kinda surprising since this has been in Safari for years.
posted by justcorbly to Computers & Internet (8 answers total) 1 user marked this as a favorite
It's not a Safari issue, but a problem with a redirect loop. Generally this is because a site (BBC News in your case) has an error in a rule in their .htaccess file. But there's no way you, as a reader, can fix this. Someone server-side needs to know about it and fix the rule.
posted by nitsuj at 5:19 AM on July 9, 2010

There are a few reasons other browsers open the site just fine. Two things that come to mind are 1) caching [have you opened that site in another browser before?] and 2) perhaps the rule that's causing the redirecting loop is something that targets specific browsers.
posted by nitsuj at 5:38 AM on July 9, 2010

The only thing Safari is doing differently is identifying itself as Safari and not as Firefox or IE or Opera. The BBC site is doing user-agent sniffing and serving different content to different browsers, and they have a bug in their code that creates a loop. It has nothing to do with the actual redirect handling code in Safari, and if you want to verify this then tell it to send a different user-agent string.
posted by Rhomboid at 6:06 AM on July 9, 2010 [1 favorite]

Response by poster: >>"...an error in a rule in their .htaccess "

Thanks, nitsuj. Thought as much.
posted by justcorbly at 6:07 AM on July 9, 2010

The goal is to stop infinite loops. But with today's modern websites, and constant redesigns of their URL schemes, it can happen that there is a long series of correct redirects to get from some old URL to the current one. If it happens to go over the arbitrary limit that the browser sets, you get the error.

In Firefox, you can see the corresponding limit in about:config under the network.http.redirection-limit value. The default is 20, and used to be 10 but was increased to stop false positives. I can't find the exact value for Safari, but it may be lower.
posted by smackfu at 6:28 AM on July 9, 2010

Safari does something differently, but I'm not clear what. It could be fairly subtle, as Apple's own devforums are plagued with this issue. When you can't log into the company's own site using its own browser, you know there's something bugtastic going on.

On the Apple site's case, it's definitely related to cookie handling, as clearing the cookies makes it go away.
posted by bonaldi at 6:45 AM on July 9, 2010

Safari's rules about when and how to accept and send cookies are different from other browser's (details here). Where I work, we often have to program Safari-specific workarounds for this reason. It's possible that one part of BBC's site thinks that it's setting a cookie for you appropriately, and then redirecting you to another part of the site, which fails to find the cookie (because Safari didn't send it for some old reason), which redirects you to the first part of the site, which does get the cookie, so it redirects you to the other part of the site, and back and forth forever.
posted by aparrish at 7:50 AM on July 9, 2010

Response by poster: Rhomboid, I'll try a different user-agent the next time this happens. But, I should say that this behavior on the BBC site is very sporadic and very temporary. I.e., the page that produced the redirect message this morning loads just fine this evening. In a few weeks, it might be another page, or none at all.

From a user's point of view, it's just a pain, regardless of Apple's reasons. If it loads in the competition, it ought to load in Safari.
posted by justcorbly at 3:35 PM on July 9, 2010

« Older A4 Printer In The US   |   Sandwich rage: what the 3@$!! do I pack for my... Newer »
This thread is closed to new comments.