Open the-leonat opened 5 months ago
Hello @the-leonat sorry for the delay, I was on other subjects.
In theory the stale while revalidate is working but seeing your issue, there is probably a bug.
After reading your issue, it seems the revalidation doesn't work, because it tries to store the given response that has a 304 status code. the revalidation block is the following:
err := next(customWriter, rq)
s.SurrogateKeyStorer.Invalidate(rq.Method, customWriter.Header())
statusCode := customWriter.GetStatusCode()
if err == nil {
if validator.IfUnmodifiedSincePresent && statusCode != http.StatusNotModified {
customWriter.Buf.Reset()
customWriter.Rw.WriteHeader(http.StatusPreconditionFailed)
return nil, errors.New("")
}
if statusCode != http.StatusNotModified {
err = s.Store(customWriter, rq, requestCc, cachedKey)
}
}
If it returns a detail=UNCACHEABLE-STATUS-CODE
that means you're going through the Store
function and your http status code is not a not modified.
Does souin implement asynchronous background fetching similar to varnish
grace
setting? I could not find anything about it in the docs and it seems to ignore my cache-control response header of my upstream webserver.public, max-age=120, stale-while-revalidate=3600
. after the content turns stale souin replies once with:Cache-Status: Souin; fwd=uri-miss; key={{key}}-/; detail=UNCACHEABLE-STATUS-CODE
server responds with code
304
.but 304 is not a cacheable status code by implementation. is this a bug?