simplify changing attributes + document it

This commit is contained in:
2026-09-02 14:18:53 +05:30
parent d079193194
commit 28132dfd66
4 changed files with 12 additions and 1 deletions
+7
View File
@@ -10,6 +10,13 @@ this serves a nginx server on port 8443
127.0.0.1 website.com a.website.com b.website.com sub.a.website.com 127.0.0.1 website.com a.website.com b.website.com sub.a.website.com
``` ```
to add attributes, modify the file `cookieattr`
```
# cookieattr
set $cookie_attr 'Secure; Domain=a.host.com; HttpOnly;';
```
note that the `;` at the end is the line terminator for nginx config and is necessary
next, install `just` for your system. take a look at <https://just.systems> if unsure how next, install `just` for your system. take a look at <https://just.systems> if unsure how
get `podman` too while you're at it. you don't have `openssl`? what insane operating system are you on? get openssl too. get `podman` too while you're at it. you don't have `openssl`? what insane operating system are you on? get openssl too.
+1
View File
@@ -0,0 +1 @@
set $cookie_attr 'Secure;';
+3 -1
View File
@@ -9,6 +9,8 @@ server {
ssl_certificate_key /etc/nginx/ssl/key.pem; ssl_certificate_key /etc/nginx/ssl/key.pem;
server_name a.website.com b.website.com sub.a.website.com; server_name a.website.com b.website.com sub.a.website.com;
include 'conf.d/cookieattr.part';
root /srv/www; root /srv/www;
try_files $uri $uri.html /index.html =200; try_files $uri $uri.html /index.html =200;
@@ -20,7 +22,7 @@ server {
} }
location /set { location /set {
try_files $uri $uri.html /index.html =200; try_files $uri $uri.html /index.html =200;
add_header set-cookie 'flavour=$flavour; max-age=3600;'; add_header set-cookie 'flavour=$flavour; $cookie_attr';
} }
location /clear { location /clear {
try_files $uri $uri.html /index.html =200; try_files $uri $uri.html /index.html =200;
Symlink
+1
View File
@@ -0,0 +1 @@
conf.d/cookieattr.part