Caddyfile for Angular Single Page Application (SPA)

ng build creates a directory of static files. Due to the way Angular works, you need to rewrite every URL that doesn’t exist. For example, /patterns needs to be rewritten to (but not redirected to) /

This Caddyfile serves files statically from /usr/share/caddy and performs the rewrite via try_files:

:80

root * /usr/share/caddy
file_server
try_files {path} /