Skip to content

Commit

Permalink
Allow GUIv2 WASM to be downloaded without auth in all security profiles
Browse files Browse the repository at this point in the history
Before, only this would work:

* In unsecured: http and https
* In weak: not at all
* In secured: only http

This would break loading custom WASMs on VRM, which are downloaded over
the HttpProxyOverSshTunnels over plain-text HTTP.
  • Loading branch information
wiebeytec authored and jhofstee committed Feb 10, 2025
1 parent 320188e commit 7a07caa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion meta-venus/recipes-httpd/nginx/files/http-explanation.site
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ server {
# This is needed because the wasm is downloaded as XHR. The proxying system
# VRM uses, which also ends up here, has stricter rules and doesn't just
# return 'origin', so add them here.
location /gui-beta/venus-gui-v2 {
location ~ /gui-(v2|beta)/venus-gui-v2 {
root /var/www/venus/;

gzip_static always;
Expand Down
13 changes: 9 additions & 4 deletions meta-venus/recipes-httpd/nginx/files/http.site
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ server {
proxy_set_header Host $host;
}

# This is needed because the wasm is downloaded as XHR. The proxying system
# VRM uses, which also ends up here, has stricter rules and doesn't just
# return 'origin', so add them here.
location /gui {
# The normal auth+cookie flow when opening /gui-v2 needs to function, also
# to make the websocket works, but the wasm(-related) asset files need to
# be available without cookie, for the HttpProxyOverSshTunnels (VRM).
location ~ /gui-(v2|beta)/venus-gui-v2 {
auth_request off;

# This is needed because the wasm is downloaded as XHR. The proxying system
# VRM uses, which also ends up here, has stricter rules and doesn't just
# return 'origin', so add them here.
add_header Cache-Control "no-cache";
add_header Access-Control-Allow-Origin "$http_origin";
add_header Access-Control-Allow-Credentials true;
Expand Down
13 changes: 9 additions & 4 deletions meta-venus/recipes-httpd/nginx/files/https.site
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ server {
proxy_set_header Host $host;
}

# This is needed because the wasm is downloaded as XHR. The proxying system
# VRM uses, which also ends up here, has stricter rules and doesn't just
# return 'origin', so add them here.
location /gui {
# The normal auth+cookie flow when opening /gui-v2 needs to function, also
# to make the websocket works, but the wasm(-related) asset files need to
# be available without cookie, for the HttpProxyOverSshTunnels (VRM).
location ~ /gui-(v2|beta)/venus-gui-v2 {
auth_request off;

# This is needed because the wasm is downloaded as XHR. The proxying system
# VRM uses, which also ends up here, has stricter rules and doesn't just
# return 'origin', so add them here.
add_header Cache-Control "no-cache";
add_header Access-Control-Allow-Origin "$http_origin";
add_header Access-Control-Allow-Credentials true;
Expand Down

0 comments on commit 7a07caa

Please sign in to comment.