Caddyfile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {
  2. http_port 80
  3. }
  4. # API subdomain — прокси на backend + MinIO + MinIO console (HTTP, SSL на Synology)
  5. http://api.{$DOMAIN} {
  6. # MinIO Console (встраивается в iframe в админке)
  7. handle_path /minio/* {
  8. reverse_proxy minio:9002
  9. header {
  10. -X-Frame-Options
  11. Content-Security-Policy "frame-ancestors http://{$DOMAIN} https://{$DOMAIN};"
  12. }
  13. }
  14. handle_path /files/* {
  15. reverse_proxy minio:9000 {
  16. header_up Host {host}
  17. header_up X-Real-IP {remote}
  18. }
  19. }
  20. reverse_proxy backend:8080 {
  21. header_up Host {host}
  22. header_up X-Real-IP {remote}
  23. header_up X-Forwarded-Proto {scheme}
  24. }
  25. header {
  26. X-Content-Type-Options "nosniff"
  27. X-Frame-Options "DENY"
  28. Referrer-Policy "strict-origin-when-cross-origin"
  29. Permissions-Policy "geolocation=(self), microphone=(), camera=()"
  30. }
  31. }
  32. # Frontend main domain
  33. http://{$DOMAIN} {
  34. reverse_proxy frontend:3000 {
  35. header_up Host {host}
  36. header_up X-Real-IP {remote}
  37. }
  38. header {
  39. X-Content-Type-Options "nosniff"
  40. X-Frame-Options "DENY"
  41. Referrer-Policy "strict-origin-when-cross-origin"
  42. Permissions-Policy "geolocation=(self), microphone=(), camera=()"
  43. Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://*.basemaps.cartocdn.com https://api.{$DOMAIN}; font-src 'self' data:; connect-src 'self' wss://api.{$DOMAIN} https://api.{$DOMAIN}; frame-ancestors 'none';"
  44. }
  45. @static {
  46. path /_next/static/*
  47. path /static/*
  48. path /images/*
  49. path /favicon.ico
  50. }
  51. header @static Cache-Control "public, max-age=31536000, immutable"
  52. encode zstd gzip
  53. }