From e62fbb5b28e1a3ebbbd681e4d2a663b0fff4a069 Mon Sep 17 00:00:00 2001 From: Shaun Sharples Date: Wed, 18 Oct 2023 16:32:51 +0200 Subject: [PATCH] Add Cache-Control: no-cache to headers --- CHANGELOG.md | 1 + src/Servant/API/EventStream.hs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e079577..f1bb803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Update version bounds to support GHC 9.6 and servant 0.20 - Drop support for `jsForAPI` and the dependency on `servant-js` - Remove dependency on pipes, breaking change for `eventSource` function +- Add "Cache-Control: no-cache" to headers ## 0.2.1.0 -- 2021-04-21 diff --git a/src/Servant/API/EventStream.hs b/src/Servant/API/EventStream.hs index 1119d56..29908c0 100644 --- a/src/Servant/API/EventStream.hs +++ b/src/Servant/API/EventStream.hs @@ -73,7 +73,7 @@ type EventSource = SourceIO ServerEvent -- | This is mostly to guide reverse-proxies like -- -type EventSourceHdr = Headers '[Header "X-Accel-Buffering" Text] EventSource +type EventSourceHdr = Headers '[Header "X-Accel-Buffering" Text, Header "Cache-Control" Text] EventSource -- | See details at -- https://hackage.haskell.org/package/wai-extra-3.1.6/docs/Network-Wai-EventSource-EventStream.html#v:eventToBuilder @@ -81,4 +81,4 @@ instance MimeRender EventStream ServerEvent where mimeRender _ = maybe "" toLazyByteString . eventToBuilder eventSource :: EventSource -> EventSourceHdr -eventSource = addHeader @"X-Accel-Buffering" "no" \ No newline at end of file +eventSource = addHeader @"X-Accel-Buffering" "no" . addHeader @"Cache-Control" "no-cache" \ No newline at end of file