Caddy - strip trailing slash

If you’re using the Caddy (v2) server and want to remove a trailing slash from URLs (as on this blog), use redir

example.com {
root * /srv/example.com
encode zstd gzip
header {
Cache-Control max-age=3600
}
@noSlash path_regexp trailingSlash ^(.+)/$
redir @noSlash {re.trailingSlash.1} 301
// ...
}