title: Rails asset_host, cloudfront and heroku
body: <p>I'm running a rails 4.0 app on heroku and for the life of me I can't get my asset urls using the host I've set in asset_host.</p>
  
  <p>I believe my cloudfront setup is good because I can substitute in my cloudfront url for any of my asset urls and the file is picked up from heroku and cached on cloudfront.</p>
  
  <p>So <a href="https://xxxxxxxxxxxx.cloudfront.net/assets/application-xxxxxxxx.js" rel="nofollow">https://xxxxxxxxxxxx.cloudfront.net/assets/application-xxxxxxxx.js</a> is caching <a href="https://myapp.com/assets/application-xxxxxxxxx.js" rel="nofollow">https://myapp.com/assets/application-xxxxxxxxx.js</a> correctly.</p>
  
  <p>The issue seems to be my assets helper, such as javascript_include_tag, are never using the asset_host setting in staging.rb.</p>
  
  <p>All I see when I load my page is all my js and css files being served from <a href="https://myapp.com/assets/" rel="nofollow">https://myapp.com/assets/</a></p>
  
  <p>My staging setup looks like this:</p>
  
  <pre><code>  # 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
  
    # 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
    #config.assets.digest = false
  
    #config.assets.initialize_on_precompile = true
  
    config.static_cache_control = "public, max-age=31536000"
  
    # user Amazon Cloudfront for asset hosting
    config.action_controller.asset_host = "https://xxxxxxxxxxxx.cloudfront.net"
  </code></pre>
  
  <p>Is there a magic combination of config settings that has somehow eluded me?</p>