diff --git a/ee/tabby-webserver/src/routes/ui.rs b/ee/tabby-webserver/src/routes/ui.rs index 86a2c5b24e44..9ad87e9b2d89 100644 --- a/ee/tabby-webserver/src/routes/ui.rs +++ b/ee/tabby-webserver/src/routes/ui.rs @@ -30,9 +30,13 @@ where match WebAssets::get(decoded_path.as_ref()) { Some(content) => { let body = Body::from(content.data); - let mime = mime_guess::from_path(path).first_or_octet_stream(); - Response::builder() - .header(header::CONTENT_TYPE, mime.as_ref()) + let mime = mime_guess::from_path(&path).first_or_octet_stream(); + let mut builder = + Response::builder().header(header::CACHE_CONTROL, "public, max-age=604800"); + if path.ends_with(".html") { + builder = builder.header(header::CONTENT_TYPE, mime.as_ref()) + }; + builder .body(body) .unwrap_or_else(|_| panic!("Invalid response")) }