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

Cache should be deleted when a page hit 404 #74

Open
K3vinF opened this issue Jul 6, 2022 · 0 comments
Open

Cache should be deleted when a page hit 404 #74

K3vinF opened this issue Jul 6, 2022 · 0 comments

Comments

@K3vinF
Copy link

K3vinF commented Jul 6, 2022

This looiks to be a regression from #3

When a page is no longer available after the page was cached, next-boost keeps serving it.
It is marked as 'stale', but the item is never removed from the cache.

I did some debugging in handler.js

If I add the following code

else { cache.del('payload:' + key) }

on line 97,. the item is correctly deleted.

So in context:

if (rv.statusCode === 200) { // save gzipped data const payload = { headers: rv.headers, body: (0, utils_1.isZipped)(rv.headers) ? body : (0, zlib_1.gzipSync)(body) }; yield cache.set('payload:' + key, (0, payload_1.encodePayload)(payload), ttl); } else { cache.del('payload:' + key) }

Steps to reproduce:

  • Visit a page;
  • Reload the page. Confirm it is server from next-boost cache;
  • Delete / unpublish the original page;
  • Reload the page again. It will be returned from next-boost;
  • Load the same page again, but with a query string to bypass next-boost (ie /page?no-cache);

The cached page will still load, but the uncached page shows a 404.

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

No branches or pull requests

1 participant