Skip to content

Commit

Permalink
Set lower max age for not found (ordinals#2240)
Browse files Browse the repository at this point in the history
  • Loading branch information
revofusion authored Jul 2, 2023
1 parent 5bed0f8 commit 11913c4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 11913c4

Please sign in to comment.