Change Cache-Control on responses to no-store

Indicate that the response may not be stored in any cache. The previous
value no-cache allows caches to store encrypted secrets but asks them to
verify on every request.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

https://github.com/Luzifer/ots/issues/36
This commit is contained in:
Vic Demuzere 2021-08-09 15:06:33 +02:00
parent a7b32ce2a4
commit 0906eeac8d
No known key found for this signature in database
GPG Key ID: 5B9EA1616690CF94

2
api.go
View File

@ -95,7 +95,7 @@ func (a apiServer) handleRead(res http.ResponseWriter, r *http.Request) {
func (a apiServer) jsonResponse(res http.ResponseWriter, status int, response map[string]interface{}) {
res.Header().Set("Content-Type", "application/json")
res.Header().Set("Cache-Control", "no-cache")
res.Header().Set("Cache-Control", "no-store, max-age=0")
res.WriteHeader(status)
json.NewEncoder(res).Encode(response)