Skip to content

Instantly share code, notes, and snippets.

@stephenmckinney
Created September 5, 2012 03:50
Show Gist options
  • Save stephenmckinney/3630075 to your computer and use it in GitHub Desktop.
Save stephenmckinney/3630075 to your computer and use it in GitHub Desktop.
Bypass CDN for SSL requests in Rails
config.action_controller.asset_host = Proc.new do |source, request|
asset_config = YAML::load(File.open(File.join(Rails.root, "config/amazon_s3.yml")))[Rails.env]
if request.ssl?
return "https://#{asset_config['bucket_name']}"
else
return "http://#{asset_config['cdn_host']}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment