|
| 1 | +safeskies.blackskyweb.xyz { |
| 2 | + # --- Compression (use both; zstd is faster/smaller where supported) |
| 3 | + encode zstd gzip |
| 4 | + |
| 5 | + # --- Security headers |
| 6 | + header { |
| 7 | + Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" |
| 8 | + X-Content-Type-Options "nosniff" |
| 9 | + X-Frame-Options "DENY" |
| 10 | + Referrer-Policy "strict-origin-when-cross-origin" |
| 11 | + |
| 12 | + # (Optional / legacy) XSS protection header; modern browsers ignore it |
| 13 | + X-XSS-Protection "1; mode=block" |
| 14 | + } |
| 15 | + |
| 16 | + # --- Common /public files (add more as needed) |
| 17 | + handle /favicon.ico { |
| 18 | + root * /srv/frontend/public |
| 19 | + file_server |
| 20 | + header Cache-Control "public, max-age=86400" |
| 21 | + } |
| 22 | + handle /robots.txt { |
| 23 | + root * /srv/frontend/public |
| 24 | + file_server |
| 25 | + header Cache-Control "public, max-age=86400" |
| 26 | + } |
| 27 | + handle /sitemap.xml { |
| 28 | + root * /srv/frontend/public |
| 29 | + file_server |
| 30 | + header Cache-Control "public, max-age=3600" |
| 31 | + } |
| 32 | + |
| 33 | + # --- Admin auth (hit backend service directly) |
| 34 | + handle /admin/auth/* { |
| 35 | + reverse_proxy backend:4000 |
| 36 | + } |
| 37 | + |
| 38 | + # Handle regular OAuth callbacks |
| 39 | + handle /auth/* { |
| 40 | + reverse_proxy backend:4000 |
| 41 | + } |
| 42 | + |
| 43 | + # Serve client metadata from backend |
| 44 | + handle /oauth/client-metadata.json { |
| 45 | + reverse_proxy backend:4000 |
| 46 | + } |
| 47 | + |
| 48 | + # Handle front-end login and callback after original OAuth callback returns |
| 49 | + handle /oauth/* { |
| 50 | + reverse_proxy frontend:3000 |
| 51 | + } |
| 52 | + |
| 53 | + # --- Everything else → Next.js server |
| 54 | + # (do NOT SPA-fallback; let Next handle routing) |
| 55 | + reverse_proxy frontend:3000 { |
| 56 | + header_up Host {host} |
| 57 | + } |
| 58 | + |
| 59 | + # --- Access log |
| 60 | + log { |
| 61 | + output file /var/log/caddy/access.log |
| 62 | + format console |
| 63 | + } |
| 64 | +} |
0 commit comments