bogenpirat / remote-torrent-adder

A handy Chrome extension to add torrent files to torrent clients
233 stars 81 forks source link

Could not contact Transmission | Error: OK #309

Closed dasweger closed 2 years ago

dasweger commented 3 years ago

transmission-cli + transmission-daemon [Transmission 2.92 (14714)] running on Ubuntu

Trying to get RTA going with a remote WebUI connection with reverse proxy (tried both ngrok and cloudflare).

I'm able to visit the ngrok/argo tunnel (cloudflare) URL in my browser (Chrome 91) and sign into the Transmission WebUI without any issue. Both http and https works with these URLs.

With RTA + http I'm getting the error mentioned in the title, Could not contact Transmission Error: OK

I've tried setting RTA port as 80 as well as leaving it blank. Same result either way. I've enabled and disabled Link Catching. Same result either way. I've tried setting credentials in RTA options as well as leaving them blank (and signing into webUI via browser before using RTA). I've also noticed that I'm able to sign into the WebUI via RTA and then the authentication carries over when using WebUI in browser without me having to sign in there.

I've checked the network tab via background page method to see if anything stands out. I'm getting an "rpc" Name with a "301 Moved Permanently" status code followed by a "web/" Name with a "200 OK (from disk cache)" status code.

I'm guessing this is related to the ngrok/argo tunnel (cloudflare) tunnel/reverse-proxy? Am I missing anything else?

RTA options: Name |  Transmission Type | Transmission WebUI Host |cloudflareDomain.com Port | 80, 443 or BLANK SSL | (unchecked for http or checked for https) Username | WebUIuserHERE Password | WebUIpasswordHERE Path(optional) | (Path left blank)

bogenpirat commented 3 years ago

I've also noticed that I'm able to sign into the WebUI via RTA and then the authentication carries over when using WebUI in browser without me having to sign in there.

yeah, that's unfortunately the way chrome handles things. the alternative would be to manually log out of the ui everytime an RTA request is completed.

I'm guessing this is related to the ngrok/argo tunnel (cloudflare) tunnel/reverse-proxy? Am I missing anything else?

that's a fair guess. have you tried RTA directly against the transmission without reverse proxying?

if that works, unfortunately i cannot help you debug your reverse proxy issues. from what i can recall wrt cloudflare's services, they offer f.e. ddos mitigation that often throws a wrench into automated requests. perhaps something like that is enabled?

you've already peeked at the correct approach by taking a look at the network tab in the dev tools - what do the headers look like? 301/2 are redirect status codes, where does it redirect? there's typically a Location header associated with it. but i assume that the answer is /web, which is confusing because that's not behavior that i've previously observed. in any case, RTA tries to mimic what a regular browser would do when you use the web ui, so stepping through what the browser does vs. what RTA fails to do would be my approach.

your settings look fine. for http, you should choose port 80, for https, choose port 443, don't leave the field blank.

PS: transmission 2.92 is five years old. i'd recommend an update or preferably switching to another client.

dasweger commented 3 years ago

Appreciate the response. After testing each and every possible variable I could think of it seems the errors may have just come down to user error(?!). Only thing I can think of is that I maybe had been leaving a trailing / on the proxy domain in the RTA host field. I didn't think I would have done something like that but can't think of what else it could have been. EDIT: After playing around a bit more, the errors come back after changing the RTA extension settings to either "On specific sites" or "on click" and ONLY works with "on all sites". So perhaps this was the culprit all along. Is this a known issue? (I'll look through the open/closed issues) Chrome Version 91.0.4472.114 (Official Build) (64-bit) [Chrome OS]

I took your suggestion and updated Transmission to latest version and used an ngrok tunnel to rule out any cloudflare issues. I also disabled all the default whitelist options in the Transmission settings.json. Signing into the WebUI through my browser first finally gave me success with RTA.

One by one by one I reversed all the changes I made to see if I could find the variable that fixed it... even going back to Transmission 2.92 and once again trying the argo/cloudflare tunnel... everything still worked afterwards, with both http/https. I'm stumped but happy it's working at this point.

Still not 100% positive what was happening and I apologize for seemingly wasting your time but at least I got an updated Transmission build along the way. I will look into switching to qbittorrent or rtorrent at some point and see if I can easily work that into my remote setup.

For anyone who may have similar questions or issues with ngrok/cloudflare tunnels and Transmission, sign into WebUI via browser first then: Name | Transmission Type | Transmission WebUI Host | ngrok-or-cloudflare-Domain.com [drop any http/https:// etc as well as any trailing "/"] Port | [leaving BLANK or setting 80(for http) or 443(for https/ssl) both worked] SSL | [Checking or unchecking both work with ngrok and argo/cloudflare tunnels] Username | [doesn't seem to make a difference if filled out or not, signing in via WebUI first is required] Password | [doesn't seem to make a difference if filled out or not, signing in via WebUI first is required] Path(optional) | [left BLANK]

Now I just need to come up with a faster way to update the RTA host field since the ngrok/argo tunnel domains change with every use.