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-Control problems #74
Comments
All right, I can add another middleware after cache middleware to set Cache-Control to other value, but still I think that is a mistake to set Cache-Control to max-age. |
Hi i want to second tsubik's request to not set this header. or make it optional. or is there a reasonable ides behind it that I do not understand? From this apart I really like apicache! keep on the good work. |
@tsubik So basically was dealing with the same problem. What I did right now to get around this issue is to set the duration in the middleware to a very high value (like 1 month). Afterwards I just add a middleware like this:
|
@tsubik @dotob @Balgorn This will be resolved in #97. I left the default behavior in to prevent breakage in existing deployed apps, but added the ability to override headers via global (or local middleware) options: let cache = apicache.options({ headers: { 'cache-control': 'no-cache' } }) That work? |
That should do it. If you can still set the maximum duration for your local Cache as before. |
Hey @kwhitley I was trying to use this library, but what I see it sets "Cache-Control" to chosen cache duration. I was intending to spare the server heavy database tasks and the cache is controlled by the server, meaning it could be cleared anytime. Setting "Cache-Control" with fixed max-age prevents some clients from hitting my endpoints, even when the cache was cleared by the server. Any workarounds? I believe Cache-Control shouldn't be set in this library or it should be an option.
The text was updated successfully, but these errors were encountered: