openvibers/openvibe.sources Commits
Sources: nginx refuses /internal/ and /metrics case-insensitively (#16)
Changes
@@@ -64,7 +64,7 @@ server {location = /release.json { proxy_pass http://127.0.0.1:4720; }# Metrics are for host-local scrapers only (http://127.0.0.1:4720/metrics).-- location = /metrics { return 404; }++ location ~* ^/metrics(/|$) { return 404; }location = / {limit_except GET { deny all; }@@@ -43,7 +43,7 @@ t('the vhost: wildcard certificate, client address from $remote_addr, /metrics 4assert.match(conf, /ssl_certificate\s+\/etc\/letsencrypt\/live\/openvibe\.network\/fullchain\.pem;/);for (const h of ['X-Real-IP', 'X-Forwarded-For', 'CF-Connecting-IP']) assert.match(conf, new RegExp(`proxy_set_header ${h} \\$remote_addr;`));assert.ok(!/proxy_add_x_forwarded_for|\$http_cf_connecting_ip|\$http_x_forwarded_for/.test(conf), 'never a client-sent address');-- assert.match(conf, /location = \/metrics \{ return 404; \}/);++ assert.match(conf, /location ~\* \^\/metrics\(\/\|\$\) \{ return 404; \}/, '/metrics is refused in any letter case');assert.match(conf, /location \^~ \/api\/v1\/ \{\s*allow 127\.0\.0\.1;\s*allow ::1;\s*deny all;/);assert.match(conf, /location \/ \{\s*default_type application\/problem\+json;\s*return 404 '\{/);const body = /return 404 '(\{.*\})';/.exec(conf)[1];
@@ -64,7 +64,7 @@ server {
@@ -64,7 +64,7 @@ server {
location = /release.json { proxy_pass http://127.0.0.1:4720; }
location = /release.json { proxy_pass http://127.0.0.1:4720; }
# Metrics are for host-local scrapers only (http://127.0.0.1:4720/metrics).
# Metrics are for host-local scrapers only (http://127.0.0.1:4720/metrics).
- location = /metrics { return 404; }
+ location ~* ^/metrics(/|$) { return 404; }
location = / {
location = / {
limit_except GET { deny all; }
limit_except GET { deny all; }
@@ -43,7 +43,7 @@ t('the vhost: wildcard certificate, client address from $remote_addr, /metrics 4
@@ -43,7 +43,7 @@ t('the vhost: wildcard certificate, client address from $remote_addr, /metrics 4
assert.match(conf, /ssl_certificate\s+\/etc\/letsencrypt\/live\/openvibe\.network\/fullchain\.pem;/);
assert.match(conf, /ssl_certificate\s+\/etc\/letsencrypt\/live\/openvibe\.network\/fullchain\.pem;/);
for (const h of ['X-Real-IP', 'X-Forwarded-For', 'CF-Connecting-IP']) assert.match(conf, new RegExp(`proxy_set_header ${h} \\$remote_addr;`));
for (const h of ['X-Real-IP', 'X-Forwarded-For', 'CF-Connecting-IP']) assert.match(conf, new RegExp(`proxy_set_header ${h} \\$remote_addr;`));
assert.ok(!/proxy_add_x_forwarded_for|\$http_cf_connecting_ip|\$http_x_forwarded_for/.test(conf), 'never a client-sent address');
assert.ok(!/proxy_add_x_forwarded_for|\$http_cf_connecting_ip|\$http_x_forwarded_for/.test(conf), 'never a client-sent address');
- assert.match(conf, /location = \/metrics \{ return 404; \}/);
+ assert.match(conf, /location ~\* \^\/metrics\(\/\|\$\) \{ return 404; \}/, '/metrics is refused in any letter case');
assert.match(conf, /location \^~ \/api\/v1\/ \{\s*allow 127\.0\.0\.1;\s*allow ::1;\s*deny all;/);
assert.match(conf, /location \^~ \/api\/v1\/ \{\s*allow 127\.0\.0\.1;\s*allow ::1;\s*deny all;/);
assert.match(conf, /location \/ \{\s*default_type application\/problem\+json;\s*return 404 '\{/);
assert.match(conf, /location \/ \{\s*default_type application\/problem\+json;\s*return 404 '\{/);
const body = /return 404 '(\{.*\})';/.exec(conf)[1];
const body = /return 404 '(\{.*\})';/.exec(conf)[1];