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

Support cached event handlers with varies (custom headers) #1031

Closed
pi0 opened this issue Mar 7, 2023 · 1 comment · Fixed by #1184
Closed

Support cached event handlers with varies (custom headers) #1031

pi0 opened this issue Mar 7, 2023 · 1 comment · Fixed by #1184
Labels
discussion enhancement New feature or request

Comments

@pi0
Copy link
Member

pi0 commented Mar 7, 2023

Context: #1023 (reply in thread)

By default, we drop all incoming request headers from being passed to the cached event handler. This is to ensure cache is not leaked and users get the same response.

However, a valid usecase might be actually intentionally supporting multiple cached responses based on headers (language, variant, multi domain, etc). We might support an opt-in feature varies: [host, x-domain] that creates cache segments for each variant and using hashed values to map.

Related/Similar spec to inspire: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary

@pi0 pi0 added enhancement New feature or request discussion labels Mar 7, 2023
@Botz
Copy link
Contributor

Botz commented Apr 13, 2023

This feature would be very helpful, our nuxt app is deployed on different domains with different locales and we would like to use routeRules for caching.
I would like to help to implement it. Do i just have to extend the getKey method? Should i also add the headers which are defined in varies to the request? Is there something else to consider?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants