Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx + Transmission: Not able to connect to server #52

Open
NazarKosteckij opened this issue Mar 18, 2021 · 4 comments
Open

Nginx + Transmission: Not able to connect to server #52

NazarKosteckij opened this issue Mar 18, 2021 · 4 comments

Comments

@NazarKosteckij
Copy link

NazarKosteckij commented Mar 18, 2021

When connecting directly to remote transmission with url kind of http://192.168.1.5:9091/ it works fine. But when adding a proxy the extension cannot connect to url http://torrent.my-domain.com/ . I discovered that might be missconfiguration of basic auth of my proxy. After I changed the url to this http://username:[email protected] it started to work.

upstream transmission  {
      server localhost:9091; #Transmission
}
server {
    if ($host = torrent.my-domain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
  listen 80;
  server_name   torrent. my-domain.com
  # enforce https
  return 301 https://$server_name$request_uri;
  server_tokens off;
    # Redirect non-https traffic to https
    # if ($scheme != "https") {
    #     return 301 https://$host$request_uri;
    # } # managed by Certbot
}
server {
      listen 443;
      ssl    on;
    ssl_certificate  ################
    ssl_certificate_key ################
server_tokens off;
      server_name torrent.my-domain.com
      location / {
          return 301 http://$server_name/transmission/;
      }
      location ^~ /transmission {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_set_header X-NginX-Proxy true;
          proxy_http_version 1.1;
          proxy_set_header Connection "";
          proxy_pass_header X-Transmission-Session-Id;
          auth_basic "Restricted Content";
          auth_basic_user_file /etc/nginx/.htpasswd;

          location /transmission/rpc {
              proxy_pass http://transmission;
          }
          location /transmission/web/ {
              proxy_pass http://transmission;
          }
          location /transmission/upload {
              proxy_pass http://transmission;
          }
          location /transmission/web/style/ {
              alias /usr/share/transmission/web/style/;
          }
          location /transmission/web/javascript/ {
              alias /usr/share/transmission/web/javascript/;
          }
          location /transmission/web/images/ {
              alias /usr/share/transmission/web/images/;
          }
          location /transmission/ {
              return 301 http://$server_name/transmission/web;
          }
      }
}
@NomadicBits
Copy link

Seeing the same issue rpc endpoints are returning a 409

409: Conflict
Your request had an invalid session-id header.

To fix this, follow these steps:

When reading a response, get its X-Transmission-Session-Id header and remember it
Add the updated header to your outgoing requests
When you get this 409 error message, resend your request with the updated header
This requirement has been added to help prevent CSRF attacks.

X-Transmission-Session-Id: yhTvWqiDX189AEIhwx2izuqVGp9h2nCxNmlxdSsdCj0Dye3X

@NomadicBits
Copy link

Debugging in to this it looks really strange:
in my chrome debugger

if (errorThrown === 'Conflict') {

errorThrown = "" when clearly im running the 409 error. This causes the session id to never update and rpc will just loop fail

@NomadicBits
Copy link

Im going to put in a PR for changing errorthrown to jqXHR.status = 409

@NomadicBits
Copy link

Cancelled PR in favor of the one submitted 2 years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants