Last active
March 12, 2025 04:03
-
-
Save Belphemur/47f76c40defef0269615 to your computer and use it in GitHub Desktop.
Configuration to use nginx as reverse proxy for Transmission BT with SSL/HTTP2 protected with auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream transmission { | |
server 127.0.0.1:9091; #Transmission | |
} | |
server { | |
listen 443 ssl http2; | |
server_name example.com; | |
auth_basic "Server Restricted"; | |
auth_basic_user_file /var/www/myWebSite/web/.htpasswd; | |
# Path to the root of your installation | |
error_log /var/www/myWebSite/logs/error.log; | |
access_log /var/www/myWebSite/logs/access.log; | |
### SSL cert files ### | |
ssl_certificate /var/www/myWebSite/ssl/advert.crt; | |
ssl_certificate_key /var/www/myWebSite/ssl/advert.key; | |
### Add SSL specific settings here ### | |
ssl_session_timeout 10m; | |
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; | |
ssl_prefer_server_ciphers on; | |
location / { | |
return 301 https://$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; | |
add_header Front-End-Https on; | |
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 https://$server_name/transmission/web; | |
} | |
} | |
} |
Did not work for me as written above, it would only show some text with none of the JavaScript or styles. Once I commented out the /style, /JavaScript, and /image parts it worked perfectly.
I've been at it for hours.
turns out you only needing this
proxy_pass_header X-Transmission-Session-Id;
Here's my full confignuration
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name transmission.example.com;
set $transmissionbt_web 127.0.0.1;
ssl_certificate /etc/letsencrypt/live/transmission.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/transmission.example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000" always;
ssl_trusted_certificate /etc/letsencrypt/live/transmission.example.com/chain.pem;
ssl_stapling on;
ssl_stapling_verify on;
proxy_hide_header X-Frame-Options; # this should allow iframe
location / {
proxy_read_timeout 300;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass_header X-Transmission-Session-Id;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://$transmissionbt_web:9091;
}
}
I've attempted this solution but it doesn't work for me. The page initially loads, asks for login credentials and starts loading the interface but after a few moments, an error message appears indicating connection problems.
Checking the developer tools, I see a list of RPC calls attempts to the server but for which the UI never gets a response.
Have you guys had the same issue?
Thanks for the ready and working solution, @Zen3515!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does not work reliably with https://github.com/ronggang/transmission-web-control
Breaks Mobile UI and Original UI