diff --git a/backend/app/rest/api/rest.go b/backend/app/rest/api/rest.go index 33a4ac24..84347580 100644 --- a/backend/app/rest/api/rest.go +++ b/backend/app/rest/api/rest.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "net/http" - "strconv" "strings" "sync" "time" @@ -587,7 +586,7 @@ func cacheControl(expiration time.Duration, version string) func(http.Handler) h fn := func(w http.ResponseWriter, r *http.Request) { e := `"` + etag(r, version) + `"` w.Header().Set("Etag", e) - w.Header().Set("Cache-Control", "max-age="+strconv.Itoa(int(expiration.Seconds()))) + w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%d, no-cache", int(expiration.Seconds()))) if match := r.Header.Get("If-None-Match"); match != "" { if strings.Contains(match, e) { diff --git a/backend/app/rest/api/rest_test.go b/backend/app/rest/api/rest_test.go index 984ff8c4..f59158cf 100644 --- a/backend/app/rest/api/rest_test.go +++ b/backend/app/rest/api/rest_test.go @@ -326,7 +326,7 @@ func TestRest_cacheControl(t *testing.T) { assert.Equal(t, http.StatusOK, resp.StatusCode) t.Logf("%+v", resp.Header) assert.Equal(t, `"`+tt.etag+`"`, resp.Header.Get("Etag")) - assert.Equal(t, `max-age=`+strconv.Itoa(int(tt.exp.Seconds())), resp.Header.Get("Cache-Control")) + assert.Equal(t, `max-age=`+strconv.Itoa(int(tt.exp.Seconds()))+", no-cache", resp.Header.Get("Cache-Control")) }) }