gorhill / uBO-Extra

A companion extension to uBlock Origin
GNU General Public License v3.0
654 stars 42 forks source link

uBO-Extra enabled causes connection loops with Plex #42

Closed Givemeyourgits closed 7 years ago

Givemeyourgits commented 7 years ago

When uBO-Extra is enabled, I get continuously failed connects when trying to access my media server via my Plex portal. If I disable uBO-Extra (while uBO & Privacy Badger are still running) the problem goes away.

image

Plex is a media server similar to Windows Media Center, you have the ability to create multiple servers and access them all from https://app.plex.tv which securely redirects to your local server. Somewhere in this process, uBO-Extra is tripping. I do not see any blocks in the uBO log files. As of right now, the only solution I can find is to disable uBO-Extra if I want to continue using Chrome (I do).

gorhill commented 7 years ago

Unfortunately, no versions for uBO-Extra/uBO provided.

I do not see any blocks in the uBO log files.

You mean uBO's logger I suppose? Did you select the All entry at the top of the logger? The behavior you describe is as if one of the network request was blocked. Does this work if you leave uBO-Extra enabled but disable both uBO and Privacy Badger?

Givemeyourgits commented 7 years ago

uBO 1.12.0 / uBO-Extra 2.20 both running latest.

Yes, uBO logger. Yes, I have used All and the specific tab, both show the same thing. I don't see anything being blocked. The behavior of Plex, when using their site rather than connecting to my servers directly, is to redirect requests to my server. I know if you run dnsmasq (which I don't) it can foul this up, not sure if that helps determine where the problem lies.

gorhill commented 7 years ago

uBO makes a network request HEAD to the the remote server to find out whether it should block websocket connections. Example:

a

The request wasn't blocked by an extension and thus the websocket connection was not forcibly closed.

Is there anything of interest in the Network tab?

Givemeyourgits commented 7 years ago

If I turn on uBO-Extra I start getting these messages:

Mixed Content: The page at 'https://app.plex.tv/web/app#!/status' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://plex.tv/'. This request has been blocked; the content must be served over HTTPS.

If I turn it off and refresh the page, I don't get any error messages and everything works.

Just a little information, I have "required secure connections" in Plex, so if it doesn't see secure connections (ssl and a few other things) it will not allow connections at all. When uBO-Extra is turned on, it is being forced to go to http://plex.tv/ rather than https://plex.tv as a failover which ends up throwing the above error and not allowing the connection.

gorhill commented 7 years ago

When uBO-Extra is turned on, it is being forced to go to http://plex.tv/ rather than https://plex.tv as a failover

uBO does not redirect web pages, I don't understand why there would be a downgrade from https to http when uBO-Extra is present. What exactly is forcing your page to fall to http?

If the document from which uBO-Extra execute has its window.location.origin equals to 'https://app.plex.tv/, this is what uBO-Extra will use to make its HEAD request.

Givemeyourgits commented 7 years ago

I really am not sure, I know it will try SSL but if it fails it will fall back to http. Something is causing it to fail when uBO-Extra is turned on. If I turn it off everything works without a problem.

Looking at debug I see this, the extension ID is uBO-Extra

image

gorhill commented 7 years ago

If I enter https://app.plex.tv/ in the address bar, the Network tab shows that the request is redirected to http://plex.tv/, then to https://plex.tv/, then again to https://www.plex.tv/.

The one redirection to http://plex.tv/ is what causes the original request to be aborted by the browser, and uBO-Extra sees this as the request being blocked by an extension (it was the browser itself), and thus cancels the websocket connection.

I will need to investigate if this can be fixed, and how if so.

Givemeyourgits commented 7 years ago

I don't see that, this is when I goto https:/app.plex.tv

image

If I go to "launch" which shows my panel, I only get "mixed content" errors when uBO-Extra is running, otherwise, it is pure HTTPS.

(When uBO-Extra is loaded) image

When it isn't, I don't see any of these messages, and I don't get endless timeouts.

gorhill commented 7 years ago

I don't see that

This is definitely the issue. You have to look into the Network pane, not what the console reports.

Givemeyourgits commented 7 years ago

I am using network pane.

image

gorhill commented 7 years ago

The console is covering your Network pane. That is the Network pane, and the evidence that https://app.plex.tv/ is redirected by the server to http://plex.tv/:

a

gorhill commented 7 years ago

I had to create an exception to fix this, I couldn't find any other way. Just to be sure, would you mind testing v2.21 in Releases by installing the extension manually?

Givemeyourgits commented 7 years ago

I see what you mean about console now and confirm I see the same thing now.

The beta version works like a champ, thank you for responding so fast!