avoid sending unnecessary push cookie
This commit is contained in:
parent
0a2a791a2c
commit
fddfa68695
@ -72,11 +72,20 @@ http {
|
|||||||
|
|
||||||
if_modified_since before;
|
if_modified_since before;
|
||||||
|
|
||||||
map $http_cookie $preload_resources {
|
map $http_cookie $nopush {
|
||||||
"~*__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";
|
"~*__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";
|
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 {
|
server {
|
||||||
listen 80 backlog=4096;
|
listen 80 backlog=4096;
|
||||||
listen [::]:80 backlog=4096;
|
listen [::]:80 backlog=4096;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
add_header Link $preload_resources always;
|
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;
|
http2_push_preload on;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user