Closed Bug 1197399 Opened 9 years ago Closed 9 years ago

t.co & other shortener links redirect loop or take longer to resolve

Categories

(Firefox for iOS :: General, defect)

Other
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fxios + ---

People

(Reporter: rolandtanglao, Unassigned)

References

Details

steps to reproduce (reproduced on iphone 6 plus and ipad air 2 running ios 8.4.1

1. open fennec aurora build 37
2. mobile.twitter.com
3. tap on any link in the list of tweets

expected behaviour:

tapped link opens in t.co/some_random_id which redirects to the actual link which opens in fennec

actual result:

spins at t.co/some_random_id

this works fine in Safari
here's my curl session output (not sure if i got the User Agent right)
Rolands-MBP:BIKETOWORKSHOP_COM_SURGE rolandtanglao$ curl -ILA "Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12D508 Safari/600.1.4" http://t.co/N9vtiDampH
HTTP/1.1 200 OK
cache-control: private,max-age=300
content-length: 0
content-type: text/html; charset=utf-8
date: Fri, 21 Aug 2015 22:54:31 GMT
expires: Fri, 21 Aug 2015 22:59:31 GMT
server: tsa_a
set-cookie: muc=7e22c61b-3228-443f-90ac-b835706344b3; Expires=Wed, 02 Aug 2017 22:54:31 GMT; Domain=t.co
x-connection-hash: ba2f78988e2f8faf3573de0abe3c26d1
x-response-time: 10
x-xss-protection: 1; mode=block
hmmm wrong UA in comment #1, i used whatsmyip and here is a better curl with the "real UA":

Rolands-MBP:BIKETOWORKSHOP_COM_SURGE rolandtanglao$ curl -ILA "Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12H321 Safari/600.1.4" http://t.co/N9vtiDampH
HTTP/1.1 200 OK
cache-control: private,max-age=300
content-length: 0
content-type: text/html; charset=utf-8
date: Fri, 21 Aug 2015 23:10:36 GMT
expires: Fri, 21 Aug 2015 23:15:36 GMT
server: tsa_a
set-cookie: muc=131d3196-0696-4b62-b8fd-de52282c4abd; Expires=Wed, 02 Aug 2017 23:10:36 GMT; Domain=t.co
x-connection-hash: 87566868df47a46e07b2bb987bdb00f0
x-response-time: 10
x-xss-protection: 1; mode=block
perhaps this is a twitter issue?
i've seen this problem in Vancouver and

:jsavage reproduced this problem in seattle and so did :guigs in mountainview with
https://t.co/zS5udv8flB

but :rnewman was not able to reproduce in montana
Here's the full response; t.co uses script redirects:

$ curl -iLA "Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12H321 Safari/600.1.4" http://t.co/N9vtiDampH
HTTP/1.1 200 OK
cache-control: private,max-age=300
content-length: 419
content-type: text/html; charset=utf-8
date: Sat, 22 Aug 2015 00:18:07 GMT
expires: Sat, 22 Aug 2015 00:23:07 GMT
server: tsa_a
set-cookie: muc=364bee11-1506-4d58-8a46-fb943c1b6533; Expires=Thu, 03 Aug 2017 00:18:07 GMT; Domain=t.co
x-connection-hash: d13b57aa4985ac5b30d4d05f5a303ab8
x-response-time: 11
x-xss-protection: 1; mode=block

<noscript><META http-equiv="refresh" content="0;URL=http://www.hollywoodreporter.com/news/ellen-page-confronts-ted-cruz-816811?facebook_20150821"></noscript><title>http://www.hollywoodreporter.com/news/ellen-page-confronts-ted-cruz-816811?facebook_20150821</title><script>window.opener = null; location.replace("http:\/\/www.hollywoodreporter.com\/news\/ellen-page-confronts-ted-cruz-816811?facebook_20150821")</script>%


Can't repro on simulator on desktop or on iPhone on LTE.
i have also reproduced it at home on wifi and on lte in Vancouver as we as Mozilla Vancouver
and kip gearwood has also reproduced it on his ipad over lte @revolver_coffee

but :stephan in toronto can't reproce it

:kip any ideas on how stephen and :rnewman can reproduce it
Flags: needinfo?(kgilbert)
Firefox iOS Version 1.0 (41) Twitter opened and signed in.  Tapped a few links and goes to page, no issues so far.
Still a problem?
Flags: needinfo?(rtanglao)
Summary: t.co links spin forever i.e. fails to redirect to actual link in mobile.twitter.com → t.co & other shortener links redirect loop or take longer to resolve
still a problem unfortunately on my ipad air 2 ios 8.4.1 even after i uninstalled and re-installed!
Flags: needinfo?(rtanglao)
i also tried mozilla guest with 8.8.8.8 as the DNS and mozilla with mozilla DNS and both fail on t.co links
I can reproduce in the Berlin office with t.co/Dpms1VCdtK
Definitely needs investigation.
This bug doesn't reproduce on an iPad3 (first retina) running iOS9 beta 3, it does reproduce on the same iPad3 running iOS 8.4.1

So somehow iOS 9 fixes this problem!

Some thoughts after discussing this with kip (i spoke with :kip so am clearing the needinfo for him):
1. Something is wrong with non http302 redirects on iOS 8.4.1
2. http302 redirects e.g. hg.kearwood.com work on iOS 8.4.1
3. perhaps this is unique to any redirect that uses location.replace() ? (paraphrasing Kip may have got this wrong!)
Flags: needinfo?(kgilbert)
I think this is an issue with WKWebView. See here: http://www.openradar.me/20844299
Really doubt it, as that is filed against iOS 9 and that would mean we can all reproduce. I still can't reproduce any issue here.
The bug was filed on May 6, maybe it was fixed in recent betas? I'm not sure if WKWebView is the culprit, but the issue in openradar looks very similar to this one.

Also, I'm not able to reproduce the bug on the simulator and iPhone 6 (8.4).
this works fine in Chrome for iOS on 8.4.1 so I *think* that means we should be able to fix it in Firefox for iOS since FF & Firefox are wrappers around webkit
:rnewman I stand corrected :-)

For the sake of completeness, I can reproduce this problem in Vancouver when clicking on links in m.facebook.com again on ios 8.4.1 on my iphone6plus. could be some sort of western Canadian DNS or ISP related issue; 1 or 2 years ago we had a similar issue on firefox for desktop that only occurred in Vancouver and was fixed by the Vancouver ISP.

The fact that this problem occurs in Seattle (:jsavaged repro'd) and Berlin (:madaline repro'd) is worrisome to me though!
Yeah, it definitely concerns me. The question is whether we can work around the WK bug, if that's what it is, and if we can do so before iOS 9 becomes our target.
Interestingly, I can't repro on an 8.4.1 iPad 2. Testing with http://t.co/Dpms1VCdtK from comment 11.
(In reply to Brian Nicholson (:bnicholson) from comment #22)
> Interestingly, I can't repro on an 8.4.1 iPad 2. Testing with
> http://t.co/Dpms1VCdtK from comment 11.

1. not that interesting brian :-)

2. i and everybody else Vancouver can reproduce in Vancouver on all my build 37 iOS 8.4.1 devices: iPad 3, iPad Air 2, iPhone 6+
nobody outside Vanocouver and seattle and berlin can reproduce the problem (i.e.t he problem doesn't seem to exist in Toronto or Montana)

3. finally to reproduce the problem you need to tap on a link in a twitter timeline which does the t.co redirection "dance", you won't reproduce the problem by copying and pasting the tco url or by typing the url

4. i hate to bring this up, but maybe :bnicholson or :rnewman or some other equally awesome iOS developer needs to fly up to Vancouver to repro and fix? my worry is that new zealand will see this problem or some variation of it. I will ask :bram and :nthomas to test in New Zealand to ease :-) my worry
(In reply to Roland Tanglao :rolandtanglao from comment #23)
> (In reply to Brian Nicholson (:bnicholson) from comment #22)
> > Interestingly, I can't repro on an 8.4.1 iPad 2. Testing with
> > http://t.co/Dpms1VCdtK from comment 11.
> 
> 1. not that interesting brian :-)

Yeah, I wanted to delete my comment after reading more scrollback. Interest retracted :D

What might be interesting, though, is debugging this using the Web inspector: getting document.location when this happens, seeing the referrer, any JS errors, etc. Can you get that set up, then ping me so we can walk through some tests?
I noticed something interesting in the console. Every time i open a link from Twitter. Either a t.co one or a goo.gl one, I see this:

Aug 27 21:36:38 Stefan-Arentzs-iPhone Client[3508] <Warning>: URL IS NIL! WE ARE RESETTING PROCESS POOL

This is part of the workaround we put in for the blank tabs.
10:25:51         st3fan | i'll add a comment to the bug: roland also tried with an older build where we do not reset the process pool and that resulted in the same issue for him
10:26:00         st3fan | but this is still something that needs investigation
10:26:26         st3fan | wait when did we do the KVO hack? Was that build 37
redirection instead of a HTTP 301
10:26:51         st3fan | we did in 37!
10:27:31         st3fan | so here is what is happening then i think: twitter uses JS to change document.location, that results in a nil webView.URL. We trigger on that and
                        | manually reload the page. *The original page*
10:27:54         st3fan | that is the redirect loop
10:27:58         st3fan | it is a reload loop
10:28:02         st3fan | caused by us
omg this is working for me in build 43 on ios 8.4.1. both iPhone6plus and iPad Air 2!
will mark resolved once i test on other people's devices which should be before noon pacific!
high five, fist bump etc!
I don't know if this means I'm hitting a different bug (I originally filed bug 1196771 which was marked as a dupe of this - which I'm not convinced it is), but reading list items sent from the twitter app still do not load properly for me without me turning off reading list mode and then turning it back on for that page.
closing this as works for me and others in build43 in vancouver on ios 8.4.1 iphone 6, iphone 6plus , ipad air2 (haven't tested ios 9)

moving my Angst to bug 1196771 :-)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.