Forum: Ruby on Rails asset_host with HTTPS problem, or possibly layout being cached?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
LemmingJoel (Guest)
on 2008-12-09 02:51
(Received via mailing list)
I'm having some trouble with either the asset_host feature or possible
something to do with layout caching.

I have this in my environment/production.rb:

ActionController::Base.asset_host = do |source, request|
  if request.ssl?
    "http://asset#{source.hash % 4}"

When I visit a page using HTTPS, some assets are pointing to a HTTPS
url, and others to a HTTP url. It turns out the contents of the layout
produces the HTTP urls, and the page action produces the HTTPS urls.

Perhaps the layout is being cached?? I need all assets pointing to
HTTPS urls when the page is requested using HTTPS, and likewise, I
need all assets pointing to HTTP urls when the page is requested using

Any thoughts as to why this is happening?
This topic is locked and can not be replied to.