From 2e600cc6d2f7051731b2a59619066cd184ec641f Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 25 Mar 2024 01:54:25 +0100 Subject: [PATCH] Set cache control to no-cache for all api endpoints, logging access keys instead of captcha keys --- server/src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index bcf68c8..8e5474a 100755 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -41,7 +41,7 @@ async fn main() -> std::io::Result<()> { for _ in 0..10 { let s = hex_string(10); - info!("Adding captcha key: {}", &s); + info!("Adding access key: {}", &s); capt_db.capthca_db.lock().unwrap().insert(s); } @@ -68,6 +68,10 @@ async fn main() -> std::io::Result<()> { ) .service( scope("/api") + .wrap( + middleware::DefaultHeaders::new() + .add(CacheControl(vec![CacheDirective::NoCache])), + ) .service(get_posts) .service(new_post) .service(delete_post)