summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohan Kumar <seirdy@seirdy.one>2021-11-11 11:39:30 -0800
committerDaniel Micay <danielmicay@gmail.com>2021-11-11 14:59:35 -0500
commit9918b7cc772fd4cd42b8bef67b8629f27c7817b6 (patch)
tree911e43dda751a6ddf95c10cf56c19f975178b992
parenta01f8d821df119cd731733a3be456b8a0bd05827 (diff)
Nginx regex: don't capture groups unnecessarily
Good regex form: use "?:" to specify non-capturing groups when sections don't actually reference matched groups. There's no use saving a capture in these situations.
-rw-r--r--nginx/nginx.conf8
1 files changed, 4 insertions, 4 deletions
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
index 076e4431..efea91ca 100644
--- a/nginx/nginx.conf
+++ b/nginx/nginx.conf
@@ -315,7 +315,7 @@ http {
return 404;
}
- location ~ "\.(css|js|map|mjs)$" {
+ location ~ "\.(?:css|js|map|mjs)$" {
include snippets/security-headers.conf;
add_header Cross-Origin-Resource-Policy "same-origin" always;
add_header Cache-Control "public, max-age=31536000, immutable";
@@ -336,7 +336,7 @@ http {
brotli_static off;
}
- location ~ "\.(atom|pdf)$" {
+ location ~ "\.(?:atom|pdf)$" {
include snippets/security-headers.conf;
# Chromium PDF range requests use wrong origin: https://bugs.chromium.org/p/chromium/issues/detail?id=1074261
# Thunderbird uses wrong origin for feeds: https://bugzilla.mozilla.org/show_bug.cgi?id=1698755
@@ -344,7 +344,7 @@ http {
add_header Cache-Control "public, max-age=1800";
}
- location ~ "\.(json|txt|xml)$" {
+ location ~ "\.(?:json|txt|xml)$" {
include snippets/security-headers.conf;
add_header Cross-Origin-Resource-Policy "same-origin" always;
add_header Cache-Control "public, max-age=1800";
@@ -360,7 +360,7 @@ http {
return 301 /$1;
}
- location ~ "(/index|\.(br|gz|html))$" {
+ location ~ "/index|\.(?:br|gz|html)$" {
internal;
}