Skip to content

Enable browser caching of signed assets #109

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

Merged
merged 1 commit into from
Nov 3, 2017

Conversation

damz
Copy link
Contributor

@damz damz commented Nov 1, 2017

For discussion. This could live in the origin configuration too, but unfortunately we would need to remove the rewriting done in recv.vcl if we wanted to do that, so we might as well have the whole configuration of static asset caching live in Fastly.

When asset signing is enabled (i.e. when assets are referenced
in the front-end with the deployment version in the URL, like
`/static/versionXXXXXXX/...`), it is safe to indicate to the
browser that it can "forever cache" the assets.

We add a `Cache-Control: max-age=31536000` header for that purpose,
if we found out that the original URL was signed.
@vvuksan vvuksan merged commit 242ddfc into fastly:master Nov 3, 2017
@vvuksan
Copy link
Contributor

vvuksan commented Nov 3, 2017

It makes sense since these assets are versioned so very long cache times make sense.

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

Successfully merging this pull request may close these issues.

2 participants