## example for a dedidcated FQDN and radicale is served on / there
## if you are serving on /radicale/ this needs to be prepended at the obvious places
# taken from https://github.com/Kozea/Radicale/discussions/1753

caldav.example.com {
    # Append / if GETting /.web
    @get-root {
        method GET
        path /.web
    }

    redir @get-root /.web/

    # Do not auth on /.web/* or /.token/*
    @not-auth {
        not path /.web/* /.token/*
    }

    # disable this in case authentication is handled by Radicale
    basic_auth @not-auth {
        USER HASH
    }

    reverse_proxy localhost:5232 {
        # disable this in case authentication is handled by Radicale
        header_up X-Remote-User {http.auth.user.id}
        # replace "HOST" with configured hostname of URL (FQDN) in client
        header_up Host HOST
        # replace "PORT" with configured port of URL in client
        header_up X-Forwarded-Port PORT
    }
}
