File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ Open `docker-compose.yml` and replace **both occurrences** of `<SECRET_KEY>` wit
5353To enable HTTPS, edit the ` Caddyfile ` :
5454
5555- Replace ` localhost:80 ` with your domain (e.g., ` filesync.app ` ).
56- - Replace ` http://localhost:9000 ` with your domain and port (e.g., ` filesync.app:9000 ` ).
5756
5857Caddy will automatically provision and renew SSL certificates for your domain.
5958
@@ -63,10 +62,6 @@ Caddy will automatically provision and renew SSL certificates for your domain.
6362filesync.app {
6463 reverse_proxy filesync:80
6564}
66-
67- filesync.app:9000 {
68- reverse_proxy peerjs:9000
69- }
7065```
7166
7267** 5. Start the services**
Original file line number Diff line number Diff line change 11localhost:80 {
22 reverse_proxy filesync:80
3- }
4-
5- http ://localhost:9000 {
6- reverse_proxy peerjs:9000
7- }
3+ }
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ services:
55 ports :
66 - " 80:80"
77 - " 443:443"
8- - " 9000:9000"
98 volumes :
109 - ./Caddyfile:/etc/caddy/Caddyfile:ro
1110 - filesync:/data
@@ -28,6 +27,7 @@ services:
2827 peerjs :
2928 image : peerjs/peerjs-server:1.1.0-rc.2
3029 container_name : filesync-peerjs
30+ command : peerjs --path /peerjs
3131 restart : unless-stopped
3232
3333 filesync :
Original file line number Diff line number Diff line change @@ -14,6 +14,18 @@ server {
1414 proxy_set_header X-Forwarded-Proto $scheme ;
1515 }
1616
17+ # Proxy /peerjs requests to PeerJS server
18+ location /peerjs {
19+ proxy_pass http ://peerjs:9000 /peerjs;
20+ proxy_http_version 1.1;
21+ proxy_set_header Upgrade $http_upgrade ;
22+ proxy_set_header Connection "upgrade" ;
23+ proxy_set_header Host $host ;
24+ proxy_set_header X-Real-IP $remote_addr ;
25+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
26+ proxy_set_header X-Forwarded-Proto $scheme ;
27+ }
28+
1729 # Handle root `/`
1830 location = / {
1931 try_files /index .html =404 ;
Original file line number Diff line number Diff line change @@ -136,8 +136,8 @@ export class File {
136136 const isSecure = window . isSecureContext && window . location . hostname !== 'localhost' ;
137137 const peer = new Peer ( uuid , {
138138 host : window . location . hostname ,
139- port : 9000 ,
140- path : "/" ,
139+ port : isSecure ? 443 : 80 ,
140+ path : "/peerjs " ,
141141 secure : isSecure ,
142142 config : {
143143 iceServers : iceServers ,
Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ export class User {
6464 const isSecure = window . isSecureContext && window . location . hostname !== 'localhost' ;
6565 this . _peer = new Peer ( peer_id , {
6666 host : window . location . hostname ,
67- port : 9000 ,
68- path : "/" ,
67+ port : isSecure ? 443 : 80 ,
68+ path : "/peerjs " ,
6969 secure : isSecure ,
7070 config : {
7171 iceServers : iceServers ,
You can’t perform that action at this time.
0 commit comments