-
Notifications
You must be signed in to change notification settings - Fork 1
/
hello.conf
33 lines (27 loc) · 854 Bytes
/
hello.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
map $http_cookie $has_session {
default 0;
"~*session=([^;]+)" 1;
}
server {
listen 80;
listen [::]:80;
location / {
root /usr/share/nginx/html;
try_files /index.html =404;
expires -1;
sub_filter_once off;
sub_filter 'server_hostname' '$hostname';
sub_filter 'server_address' '$server_addr:$server_port';
sub_filter 'server_url' '$request_uri';
sub_filter 'server_date' '$time_local';
sub_filter 'http_host' '$http_host';
sub_filter 'http_x_forwarded_for' '$http_x_forwarded_for';
sub_filter 'cookie_session' '$cookie_session';
sub_filter 'remote_address' '$remote_addr';
sub_filter 'request_id' '$request_id';
if ($has_session = 0) {
set $session_hash $request_id;
add_header Set-Cookie "session=$session_hash; Max-Age=300; Secure; SameSite=Strict";
}
}
}