openvibers/openvibe.media Commits
Media: nginx refuses /internal/ and /metrics case-insensitively (#63)
Changes
@@@ -23,7 +23,7 @@ server {proxy_send_timeout 3600s;# Prometheus metrics are for loopback scrapers only (the app 404s proxied callers too).-- location = /metrics { return 404; }++ location ~* ^/metrics(/|$) { return 404; }location /_media_shield/b2/ {internal;@@@ -19,7 +19,7 @@ server {proxy_send_timeout 3600s;# Prometheus metrics are for loopback scrapers only (the app 404s proxied callers too).-- location = /metrics { return 404; }++ location ~* ^/metrics(/|$) { return 404; }location / {proxy_pass http://127.0.0.1:4100;@@@ -45,7 +45,7 @@ const assert = require('assert');assert.match(edgeConf, /proxy_set_header X-Media-Shield-Host \$server_name;/, 'the edge block vouches for itself');assert.match(mainConf, /proxy_set_header X-Media-Shield-Host "";/, 'openvibe.media clears the header a client could send through Cloudflare');for (const c of [edgeConf, mainConf]) assert.match(c, /proxy_set_header X-Forwarded-Host "";/);-- for (const d of ['client_max_body_size 4096m;', 'proxy_read_timeout 3600s;', 'location = /metrics { return 404; }']) assert.ok(edgeConf.includes(d), `the edge block has ${d}`);++ for (const d of ['client_max_body_size 4096m;', 'proxy_read_timeout 3600s;', 'location ~* ^/metrics(/|$) { return 404; }']) assert.ok(edgeConf.includes(d), `the edge block has ${d}`);assert.match(conf('media-shield.http.conf'), /allow 127\.0\.0\.1;\s*deny all;/, 'only loopback may refresh the cache');// send(): the route's headers plus the internal redirect, an empty 200.
@@ -23,7 +23,7 @@ server {
@@ -23,7 +23,7 @@ server {
proxy_send_timeout 3600s;
proxy_send_timeout 3600s;
# Prometheus metrics are for loopback scrapers only (the app 404s proxied callers too).
# Prometheus metrics are for loopback scrapers only (the app 404s proxied callers too).
- location = /metrics { return 404; }
+ location ~* ^/metrics(/|$) { return 404; }
location /_media_shield/b2/ {
location /_media_shield/b2/ {
internal;
internal;
@@ -19,7 +19,7 @@ server {
@@ -19,7 +19,7 @@ server {
proxy_send_timeout 3600s;
proxy_send_timeout 3600s;
# Prometheus metrics are for loopback scrapers only (the app 404s proxied callers too).
# Prometheus metrics are for loopback scrapers only (the app 404s proxied callers too).
- location = /metrics { return 404; }
+ location ~* ^/metrics(/|$) { return 404; }
location / {
location / {
proxy_pass http://127.0.0.1:4100;
proxy_pass http://127.0.0.1:4100;
@@ -45,7 +45,7 @@ const assert = require('assert');
@@ -45,7 +45,7 @@ const assert = require('assert');
assert.match(edgeConf, /proxy_set_header X-Media-Shield-Host \$server_name;/, 'the edge block vouches for itself');
assert.match(edgeConf, /proxy_set_header X-Media-Shield-Host \$server_name;/, 'the edge block vouches for itself');
assert.match(mainConf, /proxy_set_header X-Media-Shield-Host "";/, 'openvibe.media clears the header a client could send through Cloudflare');
assert.match(mainConf, /proxy_set_header X-Media-Shield-Host "";/, 'openvibe.media clears the header a client could send through Cloudflare');
for (const c of [edgeConf, mainConf]) assert.match(c, /proxy_set_header X-Forwarded-Host "";/);
for (const c of [edgeConf, mainConf]) assert.match(c, /proxy_set_header X-Forwarded-Host "";/);
- for (const d of ['client_max_body_size 4096m;', 'proxy_read_timeout 3600s;', 'location = /metrics { return 404; }']) assert.ok(edgeConf.includes(d), `the edge block has ${d}`);
+ for (const d of ['client_max_body_size 4096m;', 'proxy_read_timeout 3600s;', 'location ~* ^/metrics(/|$) { return 404; }']) assert.ok(edgeConf.includes(d), `the edge block has ${d}`);
assert.match(conf('media-shield.http.conf'), /allow 127\.0\.0\.1;\s*deny all;/, 'only loopback may refresh the cache');
assert.match(conf('media-shield.http.conf'), /allow 127\.0\.0\.1;\s*deny all;/, 'only loopback may refresh the cache');
// send(): the route's headers plus the internal redirect, an empty 200.
// send(): the route's headers plus the internal redirect, an empty 200.