lilith-platform.live/deployments/@domains/quinn.api-cache/nginx/prod.conf
2026-05-26 10:34:46 -07:00

65 lines
2.2 KiB
Text

# =============================================================================
# api.transquinnftw.com — public read cache for the Quinn admin/api on black.
# =============================================================================
# Sits in front of api.black.lan:3023 (mesh-only canonical origin). Serves
# /www/* with a 30s TTL. /admin/* refused outright (writes go via mesh).
# Webhook paths (/hooks/*) bypass cache and forward uncached.
proxy_cache_path /var/cache/nginx/quinn-api levels=1:2 keys_zone=quinn_api:50m
max_size=500m inactive=10m use_temp_path=off;
server {
listen 80;
server_name api.transquinnftw.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name api.transquinnftw.com;
ssl_certificate /etc/letsencrypt/live/api.transquinnftw.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.transquinnftw.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
# Hard refuse admin endpoints from the public edge — writes go mesh-only.
location /admin/ {
return 404;
}
# Webhook receivers (if any are added later): bypass cache, forward uncached.
location /hooks/ {
proxy_pass http://api.black.lan:3023;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache off;
proxy_buffering off;
client_max_body_size 5m;
}
# Public reads (default): cached proxy to black via mesh.
location / {
proxy_pass http://api.black.lan:3023;
proxy_cache quinn_api;
proxy_cache_valid 200 30s;
proxy_cache_valid 404 5s;
proxy_cache_use_stale error timeout updating http_502 http_503 http_504;
proxy_cache_lock on;
proxy_cache_key "$scheme$request_method$host$request_uri";
add_header X-Cache-Status $upstream_cache_status always;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 15s;
proxy_connect_timeout 5s;
}
access_log /var/log/nginx/api.transquinnftw.com.access.log;
error_log /var/log/nginx/api.transquinnftw.com.error.log;
}