openvibers/openvibe.events Commits
Events: nginx refuses /internal/ and /metrics case-insensitively (#36)
Changes
@@@ -109,10 +109,10 @@ server {location = /limits.json { proxy_pass http://127.0.0.1:4300; 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; }# Metrics are for host-local scrapers only (http://127.0.0.1:4300/metrics).-- location = /metrics { return 404; }++ location ~* ^/metrics(/|$) { return 404; }# Internal service endpoints (Live's /internal/media-events, ...) are host-local.-- location /internal/ { return 404; }++ location ~* ^/internal(/|$) { return 404; }# ── Token-guarded API for developer apps (see header) ──# Per-project quotas are enforced by the service; this only caps per-IP request rates.@@@ -158,7 +158,7 @@ t('deploy/nginx/openvibe.events.conf is the API and product origin, with no rediassert.ok(conf.includes('location /api/ {'), 'the /api/ refusal block');assert.ok(conf.includes('proxy_buffering off;'), 'SSE is not buffered');assert.ok(conf.includes('proxy_read_timeout 1h;'), 'SSE keeps its long read timeout');-- const refusals = [conf.indexOf('location = /metrics { return 404; }'), conf.indexOf('location /internal/ { return 404; }')];++ const refusals = [conf.indexOf('location ~* ^/metrics(/|$) { return 404; }'), conf.indexOf('location ~* ^/internal(/|$) { return 404; }')];assert.ok(refusals.every((i) => i >= 0), 'metrics and /internal/ are refused');assert.ok(!conf.includes('events.openvibe.network$request_uri'), 'no catch-all redirect to the old API host');const old = fs.readFileSync(path.join(__dirname, '..', 'deploy', 'nginx', 'events.openvibe.network.conf'), 'utf8')
@@ -109,10 +109,10 @@ server {
@@ -109,10 +109,10 @@ server {
location = /limits.json { proxy_pass http://127.0.0.1:4300; 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; }
location = /limits.json { proxy_pass http://127.0.0.1:4300; 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; }
# Metrics are for host-local scrapers only (http://127.0.0.1:4300/metrics).
# Metrics are for host-local scrapers only (http://127.0.0.1:4300/metrics).
- location = /metrics { return 404; }
+ location ~* ^/metrics(/|$) { return 404; }
# Internal service endpoints (Live's /internal/media-events, ...) are host-local.
# Internal service endpoints (Live's /internal/media-events, ...) are host-local.
- location /internal/ { return 404; }
+ location ~* ^/internal(/|$) { return 404; }
# ── Token-guarded API for developer apps (see header) ──
# ── Token-guarded API for developer apps (see header) ──
# Per-project quotas are enforced by the service; this only caps per-IP request rates.
# Per-project quotas are enforced by the service; this only caps per-IP request rates.
@@ -158,7 +158,7 @@ t('deploy/nginx/openvibe.events.conf is the API and product origin, with no redi
@@ -158,7 +158,7 @@ t('deploy/nginx/openvibe.events.conf is the API and product origin, with no redi
assert.ok(conf.includes('location /api/ {'), 'the /api/ refusal block');
assert.ok(conf.includes('location /api/ {'), 'the /api/ refusal block');
assert.ok(conf.includes('proxy_buffering off;'), 'SSE is not buffered');
assert.ok(conf.includes('proxy_buffering off;'), 'SSE is not buffered');
assert.ok(conf.includes('proxy_read_timeout 1h;'), 'SSE keeps its long read timeout');
assert.ok(conf.includes('proxy_read_timeout 1h;'), 'SSE keeps its long read timeout');
- const refusals = [conf.indexOf('location = /metrics { return 404; }'), conf.indexOf('location /internal/ { return 404; }')];
+ const refusals = [conf.indexOf('location ~* ^/metrics(/|$) { return 404; }'), conf.indexOf('location ~* ^/internal(/|$) { return 404; }')];
assert.ok(refusals.every((i) => i >= 0), 'metrics and /internal/ are refused');
assert.ok(refusals.every((i) => i >= 0), 'metrics and /internal/ are refused');
assert.ok(!conf.includes('events.openvibe.network$request_uri'), 'no catch-all redirect to the old API host');
assert.ok(!conf.includes('events.openvibe.network$request_uri'), 'no catch-all redirect to the old API host');
const old = fs.readFileSync(path.join(__dirname, '..', 'deploy', 'nginx', 'events.openvibe.network.conf'), 'utf8')
const old = fs.readFileSync(path.join(__dirname, '..', 'deploy', 'nginx', 'events.openvibe.network.conf'), 'utf8')