This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
forked from jpillora/cloud-torrent
-
Notifications
You must be signed in to change notification settings - Fork 310
ReverseProxy
Preston edited this page Dec 7, 2019
·
14 revisions
It's common usage that runinng Simple Torrent
on a server together with other services. It's nice to let them share the same web port or even domain.
A front web server is needed, and some tweak config to let to let the real time event stream goes through.
Nginx needs to hold a long connection to backend to keep the EventStream connected. The key tweak is that path /sync
needed these 2 lines.
proxy_set_header Connection '';
proxy_http_version 1.1;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name your.domain.tld;
ssl_certificate /usr/local/nginx/ssl/wildcard.crt;
ssl_certificate_key /usr/local/nginx/ssl/wildcard.key;
location / {
proxy_pass http://127.0.0.1:3000;
}
location /sync {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name your.domain.tld;
ssl_certificate /usr/local/nginx/ssl/wildcard.crt;
ssl_certificate_key /usr/local/nginx/ssl/wildcard.key;
location / {
# your default site config
}
location /ctorrent/ {
proxy_pass http://127.0.0.1:3000/; # note the trailing slash here, it matters!
}
location /ctorrent/sync {
proxy_pass http://127.0.0.1:3000/sync;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}
Everything gets easy when it comes with caddy!
https://your.domain.tld {
proxy / http://127.0.0.1:3000 {
transparent
}
}
https://your.domain.tld {
#default site config
root /srv/http
browse
proxy /ctorrent http://127.0.0.1:3000 {
transparent
without /ctorrent
}
}