From 11913c491ab78f5a4bc95e300b138b48b1376af3 Mon Sep 17 00:00:00 2001 From: Revofusion <138184593+revofusion@users.noreply.github.com> Date: Sun, 2 Jul 2023 03:23:14 -0600 Subject: [PATCH] Set lower max age for not found (#2240) --- src/subcommand/server.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index f354c7e31a..c5049d37f9 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -796,12 +796,18 @@ impl Server { header::CONTENT_SECURITY_POLICY, HeaderValue::from_static("default-src *:*/content/ *:*/blockheight *:*/blockhash *:*/blockhash/ *:*/blocktime 'unsafe-eval' 'unsafe-inline' data: blob:"), ); + + let body = inscription.into_body(); + let cache_control = match body { + Some(_) => "max-age=31536000, immutable", + None => "max-age=600", + }; headers.insert( header::CACHE_CONTROL, - HeaderValue::from_static("max-age=31536000, immutable"), + HeaderValue::from_str(cache_control).unwrap(), ); - Some((headers, inscription.into_body()?)) + Some((headers, body?)) } async fn preview(