# =====================================================================
# Caddyfile.local - Local development server configuration
# =====================================================================
# To manage the server, use the unified script:
#   ./caddy.sh start    # Start the server
#   ./caddy.sh stop     # Stop the server
#   ./caddy.sh restart  # Restart the server
#   ./caddy.sh status   # Check server status
# 
# DO NOT run caddy directly from other directories as it may not find
# this configuration file correctly.
# =====================================================================

:8080 {
    root * .
    file_server
    encode gzip

    # Performance optimizations
    header {
        # Remove default Caddy headers
        -Server
        -X-Powered-By
        
        # Basic security headers
        X-Frame-Options "DENY"
        X-Content-Type-Options "nosniff"
        Referrer-Policy "strict-origin-when-cross-origin"
        
        # Permissions policy
        Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()"
        
        # Cross-origin isolation headers
        Cross-Origin-Embedder-Policy "require-corp"
        Cross-Origin-Resource-Policy "same-origin"
        Cross-Origin-Opener-Policy "same-origin"
        
        # Cache control for static assets
        Cache-Control "public, max-age=31536000, immutable"
        
        # CSP with hashes for scripts and styles
    }
} 
