Skip to content

Commit 9d7362e

Browse files
author
Doro Wu
committed
fix(websocket): RELATIVE_URL_ROOT not works on websockify (fcwu#157)
1 parent ae4e571 commit 9d7362e

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

rootfs/etc/nginx/sites-enabled/default

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,30 @@ server {
1313
root /usr/local/lib/web/frontend/;
1414
index index.html index.htm;
1515

16-
location ~ /api/ {
17-
try_files $uri @api;
18-
}
19-
20-
location ~ /resize$ {
21-
try_files $uri @api;
22-
}
23-
2416
#_RELATIVE_URL_ROOT_location /_RELATIVE_URL_ROOT_/ {
2517
#_RELATIVE_URL_ROOT_ rewrite /_RELATIVE_URL_ROOT_/(.*) /$1 break;
2618
#_RELATIVE_URL_ROOT_ root /usr/local/lib/web/frontend/;
2719
#_RELATIVE_URL_ROOT_}
2820

29-
location ~ /websockify$ {
21+
location ~ .*/(api/.*|websockify) {
22+
try_files $uri @api$http_upgrade;
23+
}
24+
25+
location / {
26+
rewrite /approot/(.*) /$1 break;
27+
root /usr/local/lib/web/frontend/;
28+
}
29+
30+
location @apiwebsocket {
3031
#_RELATIVE_URL_ROOT_rewrite /_RELATIVE_URL_ROOT_/(.*) $1 break;
32+
proxy_connect_timeout 7d;
33+
proxy_send_timeout 7d;
34+
proxy_read_timeout 7d;
35+
proxy_buffering off;
36+
3137
proxy_http_version 1.1;
3238
proxy_set_header Upgrade $http_upgrade;
3339
proxy_set_header Connection "upgrade";
34-
proxy_buffering off;
35-
proxy_connect_timeout 7d;
36-
proxy_send_timeout 7d;
37-
proxy_read_timeout 7d;
3840
proxy_pass http://127.0.0.1:6081;
3941
}
4042

@@ -43,8 +45,8 @@ server {
4345
proxy_set_header X-Real-IP $remote_addr;
4446
proxy_set_header X-Forwarded-For $remote_addr;
4547
proxy_set_header Host $host;
46-
proxy_pass http://127.0.0.1:6079;
4748
max_ranges 0;
49+
proxy_pass http://127.0.0.1:6079;
4850
}
4951
}
5052

rootfs/etc/supervisor/conf.d/supervisord.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ priority=15
3838
directory=%HOME%
3939
command=/usr/bin/pcmanfm --desktop --profile LXDE
4040
user=%USER%
41+
stopwaitsecs=3
4142
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
4243

4344

web/src/components/Vnc.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default {
136136
// console.trace()
137137
console.log(`connecting...`)
138138
this.errorMessage = ''
139-
let websockifyPath = 'websockify'
139+
let websockifyPath = location.pathname.substr(1) + 'websockify'
140140
if (force || this.vncState === 'stopped') {
141141
this.vncState = 'connecting'
142142
let hostname = window.location.hostname

0 commit comments

Comments
 (0)