# Global options.
# email sets the Let's Encrypt / ACME account contact (cert expiry notices).
# For the staging test (OKF/guides/06 step 5) uncomment the acme_ca line, then
# re-comment it for production (step 6). Staging avoids LE rate limits.
{
    email you@example.com
    # acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}

git.example.com {
    reverse_proxy gitea:3000

    header {
        Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
        X-Content-Type-Options    "nosniff"
        X-Frame-Options           "SAMEORIGIN"
        Referrer-Policy           "strict-origin-when-cross-origin"
        Permissions-Policy        "geolocation=(), microphone=(), camera=()"
    }

    encode gzip

    log {
        output file /data/caddy-access.log {
            roll_size 10mb
            roll_keep 5
        }
    }
}

# Optional: a second site on the apex domain, e.g. a portfolio. It runs as its
# own compose stack, joins the shared "edge" network, and this block is the only
# thing in front of it. Rename `portfolio:8000` to its service name and port, or
# delete this block and the www block below if you only host Gitea.
example.com {
    reverse_proxy portfolio:8000

    header {
        Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
        X-Content-Type-Options    "nosniff"
        X-Frame-Options           "SAMEORIGIN"
        Referrer-Policy           "strict-origin-when-cross-origin"
        Permissions-Policy        "geolocation=(), microphone=(), camera=()"
    }

    encode gzip

    log {
        output file /data/caddy-access.log {
            roll_size 10mb
            roll_keep 5
        }
    }
}

www.example.com {
    redir https://example.com{uri} permanent
}
