mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Dont overwrite cache-control header in session middleware (#4337)
This commit is contained in:
parent
023c9f4fcd
commit
3cad3b2119
@ -1 +1 @@
|
||||
Subproject commit 15815aea74fe97360afc03496b3ad62588649af0
|
||||
Subproject commit a36865ee8ca3658fea31ba948b67b75a812e84fc
|
@ -85,16 +85,19 @@ where
|
||||
|
||||
let mut res = svc.call(req).await?;
|
||||
|
||||
// Add cache-control header. If user is authenticated, mark as private. Otherwise cache
|
||||
// up to one minute.
|
||||
let cache_value = if jwt.is_some() {
|
||||
"private"
|
||||
} else {
|
||||
"public, max-age=60"
|
||||
};
|
||||
res
|
||||
.headers_mut()
|
||||
.insert(CACHE_CONTROL, HeaderValue::from_static(cache_value));
|
||||
// Add cache-control header if none is present
|
||||
if !res.headers().contains_key(CACHE_CONTROL) {
|
||||
// If user is authenticated, mark as private. Otherwise cache
|
||||
// up to one minute.
|
||||
let cache_value = if jwt.is_some() {
|
||||
"private"
|
||||
} else {
|
||||
"public, max-age=60"
|
||||
};
|
||||
res
|
||||
.headers_mut()
|
||||
.insert(CACHE_CONTROL, HeaderValue::from_static(cache_value));
|
||||
}
|
||||
Ok(res)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user