diff --git a/src/routes.rs b/src/routes.rs index 1b2cc10..a5632bf 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -6,6 +6,7 @@ use axum::{ response::IntoResponse, }; use futures::TryStreamExt; +use reqwest::header; use tokio::sync::Mutex; use tokio_stream::Stream; use tokio_util::bytes::Bytes; @@ -19,7 +20,7 @@ pub async fn handle_secure( let decrypt = crypt::decryt(data, state.secret_key.clone().unwrap())?; let bytes = handle(decrypt, state).await?; - Ok(axum::body::Body::from_stream(bytes)) + Ok(([(header::CACHE_CONTROL, "public, max-age=31919000")], axum::body::Body::from_stream(bytes))) } pub async fn handle_unsecure( @@ -28,7 +29,7 @@ pub async fn handle_unsecure( ) -> Result { let bytes = handle(src, state).await?; - Ok(axum::body::Body::from_stream(bytes)) + Ok(([(header::CACHE_CONTROL, "public, max-age=31919000")], axum::body::Body::from_stream(bytes))) } async fn handle(