I moved your comment into a new topic, because it was unrelated to the wiki topic you commented on – the article was specifically about proxying to apps whose code you don’t control.
That said, I’m not really sure what you’re asking here. Isn’t your Caddy config equivalent? All alias
does in nginx is define an alternative root
for the file server, taking into account the path rewrite that location
implicitly performed. That distinction is not necessary in Caddy because you can choose to rewrite with handle_path
or not with handle
.
That said, I’d recommend writing your config like this:
example.com {
redir /abc /abc/
handle_path /abc/* {
root * /foo/bar
file_server
}
handle {
root * /foo
file_server
}
}
The handle
and handle_path
directives are mutually exclusive, so only the first matching one will run. The handle
has no matcher, so it’ll act as a fallback if no other handle matched.