This commit is contained in:
parent
2a043ae823
commit
e04e4f6491
31
Caddyfile-preview
Normal file
31
Caddyfile-preview
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
:3081 {
|
||||||
|
root * dist
|
||||||
|
|
||||||
|
# Match requests with trailing slashes and rewrite them
|
||||||
|
@trailing_slash {
|
||||||
|
path_regexp strip_slash ^(.+)/$ # Match paths ending with /
|
||||||
|
}
|
||||||
|
rewrite @trailing_slash {re.strip_slash.1} # Remove the trailing slash
|
||||||
|
|
||||||
|
try_files {path}.html {path}/index.html {path}
|
||||||
|
encode zstd gzip
|
||||||
|
file_server
|
||||||
|
|
||||||
|
# Cache images, videos, fonts, etc. for 1 year (365 days)
|
||||||
|
@static_assets {
|
||||||
|
path_regexp static_assets \.(jpg|jpeg|png|gif|svg|ico|mp4|webm|woff|woff2|eot|ttf|otf|js)$
|
||||||
|
}
|
||||||
|
header @static_assets Cache-Control "public, max-age=31536000, immutable"
|
||||||
|
|
||||||
|
# Optionally, you can set a fallback for other files
|
||||||
|
header ?Cache-Control "public, max-age=3600"
|
||||||
|
|
||||||
|
handle_errors {
|
||||||
|
@404 {
|
||||||
|
expression {http.error.status_code} == 404
|
||||||
|
}
|
||||||
|
rewrite @404 /404.html
|
||||||
|
file_server
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user