server {
listen 443 ssl;
ssl_certificate /certs/tls.crt;
ssl_certificate_key /certs/tls.key;
server_tokens off;
include /etc/nginx/snippets/security_headers.conf;
location / {
default_type text/html;
return 200 "
hello
";
}
location = /login {
include /etc/nginx/snippets/security_headers.conf; # add_header 를 쓰는 location 은 헤더를 다시 포함한다
add_header Set-Cookie "sid=abc123; Path=/; HttpOnly; Secure; SameSite=Lax";
default_type text/html;
return 200 "login
";
}
location /api/ {
include /etc/nginx/snippets/security_headers.conf; # add_header 를 쓰는 location 은 헤더를 다시 포함한다
add_header Cache-Control "no-store";
default_type application/json;
return 200 "{\"ok\":true}";
}
location = /missing {
include /etc/nginx/snippets/security_headers.conf;
return 404 "not found";
}
}