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

Strategy documentation should show "hitpass: false" by default #52

Open
molund opened this issue May 10, 2023 · 0 comments
Open

Strategy documentation should show "hitpass: false" by default #52

molund opened this issue May 10, 2023 · 0 comments
Labels
issue: enhancement New feature or request severity: low source: documentation status: confirmed version: Strapi 4 Issues related to the versions supported by Strapi 4

Comments

@molund
Copy link

molund commented May 10, 2023

We ran into a very tricky debugging scenario where:

a. hitpass wasn't set in our configuration
b. We had cookies in our requests because we had been using the same browsers to access the Strapi admin site

The result was that the cache appeared to be invalidating properly when tested from the browser, but actually the browser was bypassing the cache due to the default hitpass setting, which returns true if there is a cookie in the request:

function hitpass(ctx) {
  // ignore cache when authorization or cookie headers are present
  return Boolean(
    ctx.request.headers.authorization || ctx.request.headers.cookie
  );
}

The default hitpass behaviour also made it very difficult to confirm that Redis was working locally because I mistakenly used the browser with a cookie to call the rest api as part of my test.

Changing the default behaviour would be a breaking change, so I am suggesting changing all the examples in the documentation instead so they include hitpass: false.

e.g.
hitpass: false, // remove this setting to bypass the cache if authorization or cookie headers are present

@derrickmehaffy derrickmehaffy added the version: Strapi 4 Issues related to the versions supported by Strapi 4 label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement New feature or request severity: low source: documentation status: confirmed version: Strapi 4 Issues related to the versions supported by Strapi 4
Projects
None yet
Development

No branches or pull requests

2 participants