Skip to content

Commit 4b18cef

Browse files
committed
Simplify deployment: port 9000 is internal, handled automatically, and no longer exposed
1 parent 650c4ac commit 4b18cef

6 files changed

Lines changed: 18 additions & 15 deletions

File tree

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ Open `docker-compose.yml` and replace **both occurrences** of `<SECRET_KEY>` wit
5353
To 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

5857
Caddy 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.
6362
filesync.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**

deploy/Caddyfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
localhost:80 {
22
reverse_proxy filesync:80
3-
}
4-
5-
http://localhost:9000 {
6-
reverse_proxy peerjs:9000
7-
}
3+
}

deploy/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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:

nginx.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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;

web/js/modules/webrtc/file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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,

web/js/modules/webrtc/user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)