From e6cdb860cf235f73609e074f2312a5bcb1cfe998 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Wed, 11 Dec 2024 15:45:37 +0100 Subject: [PATCH] Enable caching for assets --- src/backend/assets.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/assets.rs b/src/backend/assets.rs index 6171878..437c428 100644 --- a/src/backend/assets.rs +++ b/src/backend/assets.rs @@ -40,6 +40,10 @@ pub async fn file_and_error_handler( .unwrap_or_else(|| APPLICATION_OCTET_STREAM.essence_str()), )?, ); + headers.insert( + HeaderName::from_static("cache-control"), + HeaderValue::from_static("max-age=3600, public"), + ); Ok((headers, content.contents()).into_response()) } }