Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header "if-none-match" causes server side re-rendering #42

Closed
iKoala opened this issue Feb 18, 2020 · 1 comment · Fixed by #43
Closed

Header "if-none-match" causes server side re-rendering #42

iKoala opened this issue Feb 18, 2020 · 1 comment · Fixed by #43

Comments

@iKoala
Copy link
Contributor

iKoala commented Feb 18, 2020

I found that when the browser provides request header "if-none-match" with etag value same as the generated content, cacheable-response doesn't save the response in cache after expired.
This causes the server executes SSR on every request because cacheable-response doesn't save the response cache.

Should the cache saving block

cacheable-response/index.js

Lines 123 to 127 in 55eca7a

if (!isHit) {
const payload = { etag, createdAt, ttl, data, ...props }
const value = await compress(payload)
await cache.set(key, value, ttl)
}
being place before the 304 response block

cacheable-response/index.js

Lines 117 to 121 in 55eca7a

if (!isModified) {
res.statusCode = 304
res.end()
return
}
?

@iKoala
Copy link
Contributor Author

iKoala commented Feb 18, 2020

I think it is related to this pull request #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant