# Caddy alternative to nginx. Replace example.com with your DOMAIN.
#
# Caddy auto-issues TLS via Let's Encrypt by default.

example.com {
    encode gzip zstd

    header {
        X-Content-Type-Options nosniff
        X-Frame-Options DENY
        Referrer-Policy strict-origin-when-cross-origin
        # Strict-Transport-Security "max-age=31536000; includeSubDomains"
    }

    request_body {
        max_size 1MB
    }

    @nostrjson path /.well-known/nostr.json
    handle @nostrjson {
        reverse_proxy 127.0.0.1:8080
        header Cache-Control "public, max-age=60"
        header Access-Control-Allow-Origin "*"
    }

    @api path /v1/* /healthz /openapi.json /docs /docs/*
    handle @api {
        reverse_proxy 127.0.0.1:8080
    }

    handle {
        respond "Not found" 404
    }
}
