Skip to content

Commit

Permalink
fix(websocket): RELATIVE_URL_ROOT not works on websockify (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doro Wu committed May 26, 2020
1 parent ae4e571 commit 9d7362e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
30 changes: 16 additions & 14 deletions rootfs/etc/nginx/sites-enabled/default
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,30 @@ server {
root /usr/local/lib/web/frontend/;
index index.html index.htm;

location ~ /api/ {
try_files $uri @api;
}

location ~ /resize$ {
try_files $uri @api;
}

#_RELATIVE_URL_ROOT_location /_RELATIVE_URL_ROOT_/ {
#_RELATIVE_URL_ROOT_ rewrite /_RELATIVE_URL_ROOT_/(.*) /$1 break;
#_RELATIVE_URL_ROOT_ root /usr/local/lib/web/frontend/;
#_RELATIVE_URL_ROOT_}

location ~ /websockify$ {
location ~ .*/(api/.*|websockify) {
try_files $uri @api$http_upgrade;
}

location / {
rewrite /approot/(.*) /$1 break;
root /usr/local/lib/web/frontend/;
}

location @apiwebsocket {
#_RELATIVE_URL_ROOT_rewrite /_RELATIVE_URL_ROOT_/(.*) $1 break;
proxy_connect_timeout 7d;
proxy_send_timeout 7d;
proxy_read_timeout 7d;
proxy_buffering off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_connect_timeout 7d;
proxy_send_timeout 7d;
proxy_read_timeout 7d;
proxy_pass http://127.0.0.1:6081;
}

Expand All @@ -43,8 +45,8 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:6079;
max_ranges 0;
proxy_pass http://127.0.0.1:6079;
}
}

1 change: 1 addition & 0 deletions rootfs/etc/supervisor/conf.d/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ priority=15
directory=%HOME%
command=/usr/bin/pcmanfm --desktop --profile LXDE
user=%USER%
stopwaitsecs=3
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"


Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Vnc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default {
// console.trace()
console.log(`connecting...`)
this.errorMessage = ''
let websockifyPath = 'websockify'
let websockifyPath = location.pathname.substr(1) + 'websockify'
if (force || this.vncState === 'stopped') {
this.vncState = 'connecting'
let hostname = window.location.hostname
Expand Down

1 comment on commit 9d7362e

@junhuizx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove "location resize"?

Please sign in to comment.