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

Add cache control header configuration #47

Closed
jimlambie opened this issue Jul 4, 2016 · 1 comment
Closed

Add cache control header configuration #47

jimlambie opened this issue Jul 4, 2016 · 1 comment
Assignees

Comments

@jimlambie
Copy link
Contributor

jimlambie commented Jul 4, 2016

CDN requires cache control headers configurable by mime type:

For example see the Apache directive below,
add a long cache expiration for images that are not going to change

#1 Month for all your static assets
 <filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
 Header set Cache-Control "max-age=2592000, public"
 </filesMatch>
@jimlambie jimlambie self-assigned this Jul 4, 2016
@jimlambie
Copy link
Contributor Author

Add to config:

Order of precedence: paths, mimetypes, default

headers: {
    useGzipCompression: true,
    cacheControl: {
      "default": "public, max-age=3600",
      "paths": [
        {"path/to/asset.css": "public, max-age=10800"}
      ],
      "mimetypes": [
        {"text/css": "public, max-age=86400"},
        {"text/javascript": "public, max-age=86400"},
        {"application/javascript": "public, max-age=86400"}
      ]
    }
  }

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

1 participant