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

Configure EmberCli::Deploy::File cache headers #403

Merged
merged 1 commit into from
Feb 8, 2016

Conversation

seanpdoyle
Copy link
Contributor

Closes #401.

Previously, requests for Ember assets were being proxied through
EmberCli::Deploy::File Rack middleware without the HTTP
Cache-Control header.

Ember production builds digest the filenames of images/css/js/etc.
This makes these files highly cachable.

This commit configures the underlying Rack::File middleware to serve
assets with the Cache-Control header set by Rails.

@seanpdoyle seanpdoyle force-pushed the cache-control-header branch 2 times, most recently from ab3f0e6 to e9e1399 Compare February 5, 2016 21:36
@@ -7,6 +7,8 @@

module Dummy
class Application < Rails::Application
CACHE_CONTROL_FIVE_MINUTES = "public, max-age=300"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Freeze mutable objects assigned to constants.

Closes [#401].

Previously, requests for Ember assets were being proxied through
`EmberCli::Deploy::File` Rack middleware without the HTTP
`Cache-Control` header.

Ember `production` builds digest the filenames of images/css/js/etc.
This makes these files highly cachable.

This commit configures the underlying `Rack::File` middleware to serve
assets with the `Cache-Control` header set by Rails.

[#401]: #401
@@ -7,6 +7,8 @@

module Dummy
class Application < Rails::Application
CACHE_CONTROL_FIVE_MINUTES = "public, max-age=300".freeze
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this workaround was required, as I couldn't get ClimateControl to override an ENV variable before this class was loaded.

@seanpdoyle seanpdoyle merged commit 4c67d23 into master Feb 8, 2016
@seanpdoyle seanpdoyle deleted the cache-control-header branch February 8, 2016 16:29
@wireframe
Copy link
Contributor

finally got a chance to look at this...

👍 nice work! can't wait to test this out in the next release!

@seanpdoyle
Copy link
Contributor Author

Released in 0.7.2

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.

3 participants