Hi guys I seem to misunderstand something about how to configure caddy (new to it previously apache/nginx only) despite googling a lot. How to properly set up different file server root dirs for different subpaths of same domain? Thanks a lot
However not sure this is correct/best way and still has one issue: domain.com/staging redirects me to domain.com/ domain.com/staging/ and domain.com/staging/index.html does work as expected serving file /path/to/staging/index.html
The route approach is the ideal way to deal with that. In addition, you’d probably want to add a redirect to deal with /staging to add a trailing slash.
redir /staging /staging/ 308
You’d put this before your route block. It will match on exactly /staging, and do a 308 (permanent) redirect to /staging/. After doing that, you can adjust your route matcher to /staging/* which will prevent paths like /stagingabcd from being handled by the route.