
No idea why I gave you the escaped version to use. Oh well, small matter.
Turns out, Caddy’s static fileserver is handling the request for /index.html with a permanent redirect to the canonical /, which is how the client should request an index. (more info, I see this is a recent change)
You can fix this by changing your to subdirective:
rewrite {
if {path} not_starts_with /api
to {path} {path}/ /
}
I wonder if we will see a few more people pop up with this problem soon, I believe rewriting to a specific index file is quite common.