Paper Sats: design and print paper notes that carry sats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Plaintext
50 lines
1.5 KiB
Plaintext
# TLS in front of the web app. The nginx image fills in DOMAIN. The app sends its own security headers.
|
|
server {
|
|
listen 80;
|
|
server_name ${DOMAIN};
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# Query strings are left out of the log on purpose: never log a URL that could carry a secret.
|
|
log_format papersats '$remote_addr [$time_iso8601] "$request_method $uri" $status $body_bytes_sent';
|
|
|
|
# A first line of defence per address. The app keeps its own limits per route.
|
|
limit_req_zone $binary_remote_addr zone=papersats_api:10m rate=20r/s;
|
|
limit_req_status 429;
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
server_name ${DOMAIN};
|
|
ssl_certificate /etc/nginx/tls/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/tls/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
access_log /var/log/nginx/access.log papersats;
|
|
|
|
# The status upload can hold 5000 notes of public ids. Nothing larger is ever sent.
|
|
client_max_body_size 4m;
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript application/json image/svg+xml;
|
|
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# A fee can wait on a Lightning melt (90 s) and then on the payout side. Must outlast both.
|
|
location ~ ^/api/orders/[^/]+/fee$ {
|
|
limit_req zone=papersats_api burst=40 nodelay;
|
|
proxy_read_timeout 200s;
|
|
proxy_pass http://web:3000;
|
|
}
|
|
|
|
location /api/ {
|
|
limit_req zone=papersats_api burst=40 nodelay;
|
|
proxy_pass http://web:3000;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://web:3000;
|
|
}
|
|
}
|