fix(ui): only generate cache header for files under /_next/ (thus file name got hashed checksum) (#2513)

This commit is contained in:
Meng Zhang 2024-06-26 19:58:05 +08:00 committed by GitHub
parent 52546e777e
commit b4d2477d37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,7 @@ where
let body = Body::from(content.data);
let mime = mime_guess::from_path(&path).first_or_octet_stream();
let mut builder = Response::builder().header(header::CONTENT_TYPE, mime.as_ref());
if !path.ends_with(".html") {
if path.starts_with("_next/") {
builder = builder.header(header::CACHE_CONTROL, "public, max-age=604800");
};
builder