SimonBrazell/nitter-redirect

Not redirecting until you clean Cookies & Site Data

Roboron3042 opened this issue · 18 comments

For some reason Nitter Redirect stop working (not redirecting at all) if you don't clean Cookies and Site Data of twitter.com

It seems to start happening when you log in to twitter.

This issue is also reproducible in Invidition

Hi @Roboron3042 thanks for the feedback, did you try it with another Nitter instance? Like https://nitter.snopyta.org?

Yes, I'm using nitter.42l.fr myself. It doesn't change anything.

Actually, I was mistaken about the log in part. You don't need to login, you just need to get to Twitter. And it is also reproducible on Chromium.

Steps to reproduce:

  1. Clean cookies & site data
  2. Go to twitter.com and it should redirect to nitter
  3. Toggle the redirect OFF and go to twitter.com again
  4. Toggle the redirect ON and go to twitter.com once again. This time, the redirect doesn't work, and it won't work until you do to Step 1...

Okay thanks I'll look into it, I'm thinking this is an issue with Nitter itself as it sounds like the redirects are still occurring but I'll need to investigate a little more first.

So there are no errors or warnings in the browser console when this occurs?

Great thanks @Roboron3042 I'll have a look at this some time this week, might be missing a redirect of one of the JS files.

Hi @Roboron3042 I've just pushed a new release, can you let me know if you are still experiencing this problem?

Version is 1.1.2 and the bug is still reproducible as before.

Extra info: in step 4 twitter can't load profile pics and media.

Okay, it's interesting that I haven't had anyone report this issue for my other extension I'll see if I can reproduce the same problem with it.

I suspect this is caused by a service worker that Twitter installs when you visit their site, I had a similar problem with Google Maps on privacy redirect.

Note I've added redirects for twitter images and videos now so that explains the changed behaviour in step 4.

I can reproduce it on privacy redirect also, I'm fairly certain this is indeed caused by the Twitter service worker intercepting requests and loading Twitter instead, perhaps I can add a content script that deregisters it.

For me when I try to load a different Twitter page to the one that I just used to carry out your reproduction steps it does redirect to Nitter so it seems to be a case of the Twitter service worker loading the cached result from your previous visit.

For me when I try to load a different Twitter page to the one that I just used to carry out your reproduction steps it does redirect to Nitter so it seems to be a case of the Twitter service worker loading the cached result from your previous visit.

This doesn't happen to me. Every twitter page I open is not redirected, it doesn't matter if I have visited it before or not.

Sorry yes you are right, this behaviour was exhibited by privacy redirect just confirmed it.

Okay I have a solution, but it's not ideal, I've added a script to the extension that:

  1. Loads in the scopes that the service worker would ('twitter.com').
  2. Checks for its presence and unregisters it if present.
  3. Then redirects the page to Nitter.

Unfortunately to do this the Twitter page does still have to load, but at least this corrects the issue for all future redirect so you don't have to clear site data & cookies.

How's that sound?

Didn't mean to close this, just pushed a new version for Firefox, please let me know if there are any issues and I'll reopen.

Well, it's not the best privacy-respecting solution since it still loads Twitter, but it is a very welcome improvement not having to clean site data & cookies. Well done!

Yeah true, I figured if the user is willing to disable the redirects to load Twitter then they probably won't mind loading it once more to remove the service worker before all subsequent redirects without it.

Perhaps though I could be more proactive in removing the service worker even when the redirects are disabled... Probably some room for improvement there.

@Roboron3042 I've made a modification to the fix so that Nitter Redirect now more proactively removes the Twitter SW, which should stop the need for the Twitter link to be loaded prior to the redirect after the user re-enables the extension (majority of the time, there might still be some edge cases).

Let me know if this improves the situation for you. The only problem I see with this fix is if the user actually wanted to SW installed for some reason, then they would have to remove the extension to allow it.

Cheers!

That's awesome! You did an excellent work on this. Thank you!

No worries, was a bit of a tricky one but we got there in the end, thanks for reporting!