Nested proxy configuration

I’m trying to see if configuration I have setup for proxying to internal APIs can be made more concise in any way. I currently have something that looks like the following:

proxy /api/a a:8080 {
    without /api
}
proxy /api/b1 b:8080 {
    without /api
}
proxy /api/b2 b:8080 {
    without /api
}
proxy /api/c c:8080 {
    without /api
}

There is a lot of duplicated configuration here between the various proxy directives, so I’m wondering if there is a way to nest these. Something like the following is what I might imagine:

proxy /api {
    without /api

    proxy /a a:8080
    proxy /b1 b:8080
    proxy /b2 b:8080
    proxy /bc c:8080
}

Are there any options available here?

Not without making changes to the way the Caddyfile is parsed, I think.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.