openvibers/openvibe.network Commits
Proxy the Link hub's session bootstrap on openvibe.link (#770)
Changes
@@@ -204,6 +204,21 @@ server {}# The machine hub on openvibe.link/machines is Network's page, so its API is Network's too, on the host-only# session this host signs in with: the machines list, the owner's controls and the live screen, plus machine pools.++ # The page's own session bootstrap (my/core.js: /api/auth/me and the refresh it tries): the hub keeps its++ # Network session in the host-only ov_token cookie and hydrates from here before any machine is asked for.++ location ^~ /api/auth/ {++ limit_except GET HEAD POST PUT PATCH DELETE { deny all; }++ proxy_pass http://127.0.0.1:4000;++ proxy_http_version 1.1;++ proxy_set_header Host $host;++ proxy_set_header X-Real-IP $remote_addr;++ proxy_set_header X-Forwarded-For $remote_addr;++ proxy_set_header CF-Connecting-IP $remote_addr;++ proxy_set_header X-Forwarded-Proto $scheme;++ add_header Cache-Control "no-store" always;++ }++ # The machine hub on openvibe.link/machines is Network's page, so its API is Network's too, on the host-only++ # session this host signs in with: the machines list, the owner's controls and the live screen, plus machine pools.location ~ ^/api/v1/(machines|machine-pools)(/|$) {proxy_pass http://127.0.0.1:4000;proxy_http_version 1.1;@@@ -71,6 +71,8 @@ const SHAPED = {// …the machine hub's own API (the machines list, the owner's controls, the live screen, pools), which the page// asks for on this host: without it those calls left for openvibe.network's catch-all and the hub showed nothing.assert.ok(/location ~ \^\/api\/v1\/\(machines\|machine-pools\)\(\/\|\$\) \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(vhost), 'the machine hub API is proxied on openvibe.link');++ // …and its session bootstrap: /api/auth/me hydrates the host-only cookie before a machine is asked for.++ assert.ok(/location \^~ \/api\/auth\/ \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(vhost), 'the page session bootstrap is proxied on openvibe.link');// …and /auth/* to Link's own sign-in (Network#664), or openvibe.link never signs anyone in (11-08 audit).const linkBlock = vhost.slice(vhost.indexOf(' server_name openvibe.link;'));assert.ok(/location \^~ \/auth\/ \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(linkBlock.slice(0, linkBlock.indexOf('\n}\n'))), 'the openvibe.link vhost proxies /auth/ to Network');
@@ -204,6 +204,21 @@ server {
@@ -204,6 +204,21 @@ server {
}
}
# The machine hub on openvibe.link/machines is Network's page, so its API is Network's too, on the host-only
# The machine hub on openvibe.link/machines is Network's page, so its API is Network's too, on the host-only
# session this host signs in with: the machines list, the owner's controls and the live screen, plus machine pools.
# session this host signs in with: the machines list, the owner's controls and the live screen, plus machine pools.
+ # The page's own session bootstrap (my/core.js: /api/auth/me and the refresh it tries): the hub keeps its
+ # Network session in the host-only ov_token cookie and hydrates from here before any machine is asked for.
+ location ^~ /api/auth/ {
+ limit_except GET HEAD POST PUT PATCH DELETE { deny all; }
+ proxy_pass http://127.0.0.1:4000;
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $remote_addr;
+ proxy_set_header CF-Connecting-IP $remote_addr;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ add_header Cache-Control "no-store" always;
+ }
+ # The machine hub on openvibe.link/machines is Network's page, so its API is Network's too, on the host-only
+ # session this host signs in with: the machines list, the owner's controls and the live screen, plus machine pools.
location ~ ^/api/v1/(machines|machine-pools)(/|$) {
location ~ ^/api/v1/(machines|machine-pools)(/|$) {
proxy_pass http://127.0.0.1:4000;
proxy_pass http://127.0.0.1:4000;
proxy_http_version 1.1;
proxy_http_version 1.1;
@@ -71,6 +71,8 @@ const SHAPED = {
@@ -71,6 +71,8 @@ const SHAPED = {
// …the machine hub's own API (the machines list, the owner's controls, the live screen, pools), which the page
// …the machine hub's own API (the machines list, the owner's controls, the live screen, pools), which the page
// asks for on this host: without it those calls left for openvibe.network's catch-all and the hub showed nothing.
// asks for on this host: without it those calls left for openvibe.network's catch-all and the hub showed nothing.
assert.ok(/location ~ \^\/api\/v1\/\(machines\|machine-pools\)\(\/\|\$\) \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(vhost), 'the machine hub API is proxied on openvibe.link');
assert.ok(/location ~ \^\/api\/v1\/\(machines\|machine-pools\)\(\/\|\$\) \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(vhost), 'the machine hub API is proxied on openvibe.link');
+ // …and its session bootstrap: /api/auth/me hydrates the host-only cookie before a machine is asked for.
+ assert.ok(/location \^~ \/api\/auth\/ \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(vhost), 'the page session bootstrap is proxied on openvibe.link');
// …and /auth/* to Link's own sign-in (Network#664), or openvibe.link never signs anyone in (11-08 audit).
// …and /auth/* to Link's own sign-in (Network#664), or openvibe.link never signs anyone in (11-08 audit).
const linkBlock = vhost.slice(vhost.indexOf(' server_name openvibe.link;'));
const linkBlock = vhost.slice(vhost.indexOf(' server_name openvibe.link;'));
assert.ok(/location \^~ \/auth\/ \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(linkBlock.slice(0, linkBlock.indexOf('\n}\n'))), 'the openvibe.link vhost proxies /auth/ to Network');
assert.ok(/location \^~ \/auth\/ \{[\s\S]*?proxy_pass http:\/\/127\.0\.0\.1:4000;/.test(linkBlock.slice(0, linkBlock.indexOf('\n}\n'))), 'the openvibe.link vhost proxies /auth/ to Network');