summaryrefslogtreecommitdiff
path: root/angelsharkd/src/routes/extensions
diff options
context:
space:
mode:
authorCarpenter, Adam (CORP) <adam.carpenter@adp.com>2021-11-30 12:07:14 -0500
committerCarpenter, Adam (CORP) <adam.carpenter@adp.com>2021-11-30 12:07:14 -0500
commit1fab7c878d55a307e5ef2078801be231b13ebab8 (patch)
tree22b51f1513a752bf98dfc97854be3c866addc1b8 /angelsharkd/src/routes/extensions
parent0edcb7438bac442bb24a55f25974ca225e4d2e97 (diff)
downloadaltruistic-angelshark-1fab7c878d55a307e5ef2078801be231b13ebab8.tar.xz
altruistic-angelshark-1fab7c878d55a307e5ef2078801be231b13ebab8.zip
fix: discourage caching responses with headers
Diffstat (limited to 'angelsharkd/src/routes/extensions')
-rw-r--r--angelsharkd/src/routes/extensions/simple_search.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/angelsharkd/src/routes/extensions/simple_search.rs b/angelsharkd/src/routes/extensions/simple_search.rs
index 963cb69..b728c1e 100644
--- a/angelsharkd/src/routes/extensions/simple_search.rs
+++ b/angelsharkd/src/routes/extensions/simple_search.rs
@@ -9,8 +9,10 @@ use std::{
use warp::{
body::{content_length_limit, json},
get,
- hyper::StatusCode,
- path, post, reply, Filter, Rejection, Reply,
+ hyper::{header, StatusCode},
+ path, post,
+ reply::{self, with},
+ Filter, Rejection, Reply,
};
/// Collection of search terms
@@ -20,13 +22,14 @@ type Needles = Vec<String>;
type HaystackEntries = Vec<Vec<String>>;
pub fn search(haystack: Haystack) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
- // TODO: discourage caching response thru headers
-
path("search")
.and(post())
.and(content_length_limit(1024 * 16))
.and(json())
.and_then(move |terms: Needles| handle_search(haystack.to_owned(), terms))
+ .with(with::header(header::PRAGMA, "no-cache"))
+ .with(with::header(header::CACHE_CONTROL, "no-store, max-age=0"))
+ .with(with::header(header::X_FRAME_OPTIONS, "DENY"))
}
pub fn refresh(haystack: Haystack) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {