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 configuration of cache-control max-age #7273

Closed
discordianfish opened this issue Aug 26, 2016 · 7 comments
Closed

Support configuration of cache-control max-age #7273

discordianfish opened this issue Aug 26, 2016 · 7 comments

Comments

@discordianfish
Copy link

Hi,

as of this writing, ghost doesn't seem to support customizing the cache control headers.

It would be great if I could configure that somehow, just in config.js would be fine. This is especially useful since / and the individual posts set max-age=0, which always requires revalidation and might completely disable caching (at least cloudflare with default settings).

@ErisDS
Copy link
Member

ErisDS commented Sep 19, 2016

This is an interesting proposition, we're currently in the middle of entirely refactoring and then auditing Ghost's configuration, and so it's a good time to propose changes.

I am not sure that a generic max-age config is enough, do you have an idea what configuration options you wanted/needed?

@discordianfish
Copy link
Author

Yes, more sophisticated cache settings would probably make sense. I'm personally most interested in cache settings for the dynamic, non-admin content like / and posts. Right now I setup some rules in CloudFlare to apply cache settings on a per path basis.

@ErisDS
Copy link
Member

ErisDS commented Sep 19, 2016

Could you be a bit more specific, maybe share the CloudFlare rules you're using?

@discordianfish
Copy link
Author

I simply set 2h TTL for everything except /ghost/*

@ErisDS
Copy link
Member

ErisDS commented Oct 5, 2016

I've added this as an item for review in #7488. Going to close this as we don't need both issues open for the same task. It will be reviewed before the end of the alpha phase.

@ErisDS ErisDS closed this as completed Oct 5, 2016
@HelloGrayson
Copy link

FWIW, we should think about setting no-cache on 4xx and 5xx range responses - we don't want edge caches storing these. At the very least, fine grained control might be in order.

@nodesocket
Copy link

nodesocket commented Jan 29, 2017

I'd also like to be able to set the Cache-Control header max-age that comes back on static assets. It currently seems to be hardcoded at 31536000 one year from Express.

I purpose this should be a configuration option in config.js.

cache: {
    # this would modify the header to Cache-Control: public, max-age=3600
    maxAge: 3600
}

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

4 participants