Skip to content

Instantly share code, notes, and snippets.

@ChadMoran
Created October 16, 2011 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChadMoran/1291089 to your computer and use it in GitHub Desktop.
Save ChadMoran/1291089 to your computer and use it in GitHub Desktop.
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true
config.static_cache_control = "public, max-age=31556926"
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
@stephan-buckmaster
Copy link

So the comment "# Disable Rails's static asset server" should be changed to "enable"?

Did you test it / benchmark it? I haven't heared of using unicorn itself for serving static files.

@ChadMoran
Copy link
Author

I didn't put those comments in there, sorry they should be removed. They were from the normal production.rb.

I can confirm this works

http://d10jcizdv7jp27.cloudfront.net/assets/application-6b58f8d64acb2c27182c694b2fd87c8d.js

Look at the headers.


$ curl -I http://d10jcizdv7jp27.cloudfront.net/assets/application-6b58f8d64acb2c27182c694b2fd87c8d.js
Cache-Control: public, max-age=31556926

@stephan-buckmaster
Copy link

Oh ok, and benchmark/comparison with "ordinary heroku"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment