# uncomment if ratelimited
# {
#     acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
# }

atom.town {
    root * /srv/home
    encode zstd

    # /index.html -> /
    @indexhtml path_regexp idx ^(.*/)index\.html$
    redir @indexhtml {re.idx.1} permanent

    # /something.html -> /something
    @html path_regexp strip ^(.+)\.html$
    redir @html {re.strip.1} permanent

    # something -> something.html
    try_files {path} {path}.html {path}/index.html

    file_server

    @assets path /assets/*
    header @assets Cache-Control "public, max-age=604800, immutable"
}

post.atom.town {
    reverse_proxy stalwart:8080
}

mail.atom.town {
    reverse_proxy bulwark:3000
}

git.atom.town {
    reverse_proxy gitea:3000
}
