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-control header not set #122

Closed
sbuljac opened this issue Oct 21, 2017 · 4 comments
Closed

Cache-control header not set #122

sbuljac opened this issue Oct 21, 2017 · 4 comments

Comments

@sbuljac
Copy link

sbuljac commented Oct 21, 2017

Cache-control header is not set when apicache is serving cached content.

@dominiceden
Copy link

Also had this problem. Resorting to setting the headers manually using this gist: https://gist.github.com/tagr/170627486377551831de

@bmenant
Copy link

bmenant commented Mar 29, 2018

The middleware adds a cache-control max-age (equal to the apicache duration). However, it looks like this header value is not cached (I guess because this header is added on the fly, after the cache is created).

Therefore, it’s missing when a resource is served from the cache, unless you had already set a cache-control header from your http framework (in such case, this value is cached and served on subsequent requests).

By the way, I notice the middleware overwrites any existing cache-control header... I would expect it to not overwrite that value. And perhaps even change its cache duration to that existing max-age value. What do you think?

Edit: see https://github.com/kwhitley/apicache/blob/master/src/apicache.js#L168

@Norbz
Copy link

Norbz commented Jul 25, 2018

I also have this issue where I wish the cache duration would be set from the Max Age header instead of the opposite.

I am running Nuxt as a serverside rendering framework for VueJS. Every cache duration is specifically handled. It's quite a shame to end up putting a default value for everything with header override feature.

Can we have a way to deactivate this feature and let the cache related header to what they are ?

@killdash9
Copy link
Contributor

I have fixed this issue with pull request #154. Please incorporate! It looks like there has been no activity on this project for over 6 months.

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

5 participants