why not add directive like nginx alias, nginx can do this well。
for example, if the website like this: (the bar.jpg in the foo/bar/index.html like <img src="bar.jpg">, we should make sure the img can display correct)
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:
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.