My Caddy server is working really well, it’s a delight to use and setup. Thanks to the maintainers for building this!
I’m simply serving static files, all ending in the .html extension.
Not unexpectedly, the .html extensions show up in the URL in the browser’s address bar.
However, it would be nice if I could call up my files in the URL without the .html extension, and also not show the .html extension after the file is loaded.
Example static file name: newsletter.html
Should be callable as and show as: some_domain.com/newsletter
I’ve looked through the docs (rewrite, uri, request matchers) but couldn’t quite figure it out yet.
What this will do is attempt to rewrite the request {path} to append .html if the file exists on disk inside of root. If a file with .html doesn’t exist, it does nothing and lets file_server do its thing (serve a file as normal if it does exist, or a 404 if it doesn’t, etc).