Skip to content

Instantly share code, notes, and snippets.

@dhh
Created November 27, 2008 13:57
  • Star 8 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dhh/29752 to your computer and use it in GitHub Desktop.
config.action_controller.asset_host = Proc.new do |source, request|
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com"
ssl_host = "https://asset1.backpackit.com"
if request.ssl?
case
when source =~ /\.js$/
ssl_host
when request.headers["USER_AGENT"] =~ /(Safari)/
non_ssl_host
when request.headers["USER_AGENT"] =~ /Firefox/ && source =~ /^\/images/
non_ssl_host
else
ssl_host
end
else
non_ssl_host
end
end
@v0000oooooooo
Copy link

[@](`

url

`)

@teerasak182530
Copy link

[@](`

url

`)

@tattman5787
Copy link

Uploading 220A239C-E56E-45CC-BAF6-2C3A2B5ED87D.gif…

@tattman5787
Copy link

@#``

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