31 lines
754 B
Plaintext
31 lines
754 B
Plaintext
map $host $flavour {
|
|
default 'butter';
|
|
a.website.com 'chocochip';
|
|
b.website.com 'peanutbutter';
|
|
}
|
|
server {
|
|
listen 443 ssl;
|
|
ssl_certificate /etc/nginx/ssl/cert.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/key.pem;
|
|
server_name a.website.com b.website.com sub.a.website.com;
|
|
|
|
root /srv/www;
|
|
|
|
try_files $uri $uri.html /index.html =200;
|
|
|
|
sub_filter '%COOKIE%' '$cookie_flavour';
|
|
|
|
location /flavourtest {
|
|
return 200 '$host and $flavour\n';
|
|
}
|
|
location /set {
|
|
try_files $uri $uri.html /index.html =200;
|
|
add_header set-cookie 'flavour=$flavour; max-age=3600;';
|
|
}
|
|
location /clear {
|
|
try_files $uri $uri.html /index.html =200;
|
|
add_header set-cookie 'flavour=$flavour; max-age=0';
|
|
}
|
|
error_page 497 https://$host:$request_port$request_uri;
|
|
}
|