diff --git a/rust/agama-server/Cargo.toml b/rust/agama-server/Cargo.toml index a365595124..e8735546c6 100644 --- a/rust/agama-server/Cargo.toml +++ b/rust/agama-server/Cargo.toml @@ -24,7 +24,12 @@ macaddr = { version = "1.0", features = ["serde_std"] } async-trait = "0.1.83" axum = { version = "0.7.7", features = ["ws"] } serde_json = "1.0.128" -tower-http = { version = "0.5.2", features = ["compression-br", "fs", "trace"] } +tower-http = { version = "0.5.2", features = [ + "compression-br", + "fs", + "trace", + "set-header", +] } tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } tracing-journald = "0.3.0" tracing = "0.1.40" diff --git a/rust/agama-server/src/web/service.rs b/rust/agama-server/src/web/service.rs index fb01cd5b20..1e9213a04f 100644 --- a/rust/agama-server/src/web/service.rs +++ b/rust/agama-server/src/web/service.rs @@ -21,6 +21,7 @@ use super::http::{login, login_from_query, logout, session}; use super::{config::ServiceConfig, state::ServiceState, EventsSender}; use agama_lib::auth::TokenClaims; +use axum::http::HeaderValue; use axum::{ body::Body, extract::Request, @@ -29,12 +30,14 @@ use axum::{ routing::{get, post}, Router, }; +use hyper::header::CACHE_CONTROL; use std::time::Duration; use std::{ convert::Infallible, path::{Path, PathBuf}, }; use tower::Service; +use tower_http::set_header::SetResponseHeaderLayer; use tower_http::{compression::CompressionLayer, services::ServeDir, trace::TraceLayer}; use tracing::Span; @@ -128,6 +131,10 @@ impl MainServiceBuilder { ), ) .layer(CompressionLayer::new().br(true)) + .layer(SetResponseHeaderLayer::if_not_present( + CACHE_CONTROL, + HeaderValue::from_static("no-store"), + )) .with_state(state) } } diff --git a/rust/package/agama.changes b/rust/package/agama.changes index 6a4a1fa44c..5071380e32 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 10 08:58:29 UTC 2025 - Imobach Gonzalez Sosa + +- Disable the browser cache setting the "Cache-Control" header to + "no-store" (gh#agama-project/agama#1880). + ------------------------------------------------------------------- Thu Jan 9 12:52:05 UTC 2025 - Josef Reidinger