This project is archived and is in readonly mode.
asset tag caching breaks setting asset_host to a proc
Reported by Dan Manges | October 30th, 2008 @ 04:42 PM | in 2.x
I'm using a proc to set the asset_host. I basically want to use ssl if the request is an ssl request, serve assets using the same host as the request if the user is hitting the box directly, and otherwise, use 4 different asset hosts.
The problem is that the cache key in AssetTag.create uses ActionController::Base.asset_host, which is a Proc, but evaluated as a string is always the same. So because of the caching, the Proc isn't being called and is returning the wrong results.
config.action_controller.asset_host = Proc.new do |source, request|
if request.ssl?
"#{request.protocol}#{request.host_with_port}"
elsif request.host_with_port =~ /^ror\d/i
request.host_with_port
else
"asset%d.domain.com" % (source.hash % 4)
end
end
Comments and changes to this ticket
-
Repository January 1st, 2009 @ 05:53 PM
- State changed from new to committed
(from [49a055dff639164435dfb71bf18d695970eedac9]) Fixed the AssetTagHelper cache to use the computed asset host as part of the cache key instead of just assuming the its a string [#1299 state:committed] http://github.com/rails/rails/co...
-
Repository January 1st, 2009 @ 06:20 PM
(from [ee701e0672f5b0978ace900f272b577b45bf826b]) Fixed the AssetTagHelper cache to use the computed asset host as part of the cache key instead of just assuming the its a string [#1299 state:fixed] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Tags
Referenced by
- 1299 asset tag caching breaks setting asset_host to a proc (from [49a055dff639164435dfb71bf18d695970eedac9]) Fixed t...
- 1299 asset tag caching breaks setting asset_host to a proc (from [ee701e0672f5b0978ace900f272b577b45bf826b]) Fixed t...