Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

[Bug]: error page are cached #7

Open
1 task done
marc-arnoult opened this issue Jun 2, 2022 · 0 comments
Open
1 task done

[Bug]: error page are cached #7

marc-arnoult opened this issue Jun 2, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@marc-arnoult
Copy link

Expected Behavior

We should not cache any error pages ( 404, 500... )

Actual Behavior

Actually even if the rendering contains an error, the page are put in cache.

const content = await render();
const tags = getTags();

if (!tags.length) {
  return content;
}
------> We should check if there is an error in `content`<-----
// We could add "await" here, but saving content in cache doesn't have to block the request
client.set(
  key,
  content,
  tags
);

Possible Solution

Add a check for content.error variable and do not cache the response.

Steps to reproduce

Hit a 404 page.

What version of Magento 2 integration are you using?

2.4.3

What version of Node.js are you using?

16

What browser (and version) are you using?

Chrome

What operating system (and version) are you using?

macOS

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@marc-arnoult marc-arnoult added the bug Something isn't working label Jun 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant