:8020 {
    # Enable compression
    encode gzip zstd
    
    # Set root to built files
    root * /usr/share/caddy
    
    # Authenticated app served under /app (if needed in future)
    handle_path /app* {
        uri strip_prefix /app
        try_files {path} /index.html
        file_server
    }
    
    # Marketing site is the public default
    # For SPA routing: serve the file if it exists, otherwise serve marketing.html
    # This allows direct URL access (e.g., /product, /pricing) and browser back/forward navigation
    handle {
        # Try to serve the requested file, fallback to marketing.html for all routes
        try_files {path} /marketing.html
        file_server
    }
}

