summaryrefslogtreecommitdiff
path: root/nginx
diff options
context:
space:
mode:
Diffstat (limited to 'nginx')
-rw-r--r--nginx/nginx.conf13
-rw-r--r--nginx/snippets/preload.conf2
2 files changed, 12 insertions, 3 deletions
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
index 50bac151..f113b958 100644
--- a/nginx/nginx.conf
+++ b/nginx/nginx.conf
@@ -72,11 +72,20 @@ http {
if_modified_since before;
- map $http_cookie $preload_resources {
- "~*__Host-preload=1" "<{{path|/main.css}}>; rel=preload; nopush; as=style; integrity={{integrity|/main.css}}, </fonts/roboto-v29-regular-latin.woff2>; rel=preload; nopush; as=font; crossorigin, </fonts/roboto-v29-bold-latin.woff2>; rel=preload; nopush; as=font; crossorigin, <{{path|/mask-icon.svg}}>; rel=preload; nopush; as=image";
+ map $http_cookie $nopush {
+ "~*__Host-preload=1" 1;
+ default 0;
+ }
+
+ map $nopush $preload_resources {
+ 1 "<{{path|/main.css}}>; rel=preload; nopush; as=style; integrity={{integrity|/main.css}}, </fonts/roboto-v29-regular-latin.woff2>; rel=preload; nopush; as=font; crossorigin, </fonts/roboto-v29-bold-latin.woff2>; rel=preload; nopush; as=font; crossorigin, <{{path|/mask-icon.svg}}>; rel=preload; nopush; as=image";
default "<{{path|/main.css}}>; rel=preload; as=style; integrity={{integrity|/main.css}}, </fonts/roboto-v29-regular-latin.woff2>; rel=preload; as=font; crossorigin, </fonts/roboto-v29-bold-latin.woff2>; rel=preload; as=font; crossorigin, <{{path|/mask-icon.svg}}>; rel=preload; as=image";
}
+ map $nopush $push_cookie {
+ 0 "__Host-preload=1; HttpOnly; Secure; SameSite=Lax; Path=/";
+ }
+
server {
listen 80 backlog=4096;
listen [::]:80 backlog=4096;
diff --git a/nginx/snippets/preload.conf b/nginx/snippets/preload.conf
index c3f2d886..8b369f5a 100644
--- a/nginx/snippets/preload.conf
+++ b/nginx/snippets/preload.conf
@@ -1,3 +1,3 @@
add_header Link $preload_resources always;
-add_header Set-Cookie "__Host-preload=1; HttpOnly; Secure; SameSite=Lax; Path=/" always;
+add_header Set-Cookie $push_cookie always;
http2_push_preload on;