Caddy V2 - single page app help/example? Rewrites are being weird

Just so we’re on the same page, could you give a list of pairs of URLs and which file you expect them to load? For example:

/ -> /index.html
/app -> /index.html
/work/app -> /index.html
/work/app.min.js -> /app.min.js
...

I’d like to better understand where /work comes into play here. What’s the purpose of that subpath?

I think you might be looking for try_files, which is typically what’s used for setting up fallbacks for paths that don’t map to a file on disk:

Something like this:

try_files {path} /index.html

A typical config for a simple SPA usually looks like this:

:80 {
	root * /srv
	encode gzip

	try_files {path} index.html

	file_server
}

That might be all you need.