Skip to content

Instantly share code, notes, and snippets.

@mikehale
Created April 22, 2014 20:43
Show Gist options
  • Save mikehale/11193614 to your computer and use it in GitHub Desktop.
Save mikehale/11193614 to your computer and use it in GitHub Desktop.
Workaround for sinatra-assetpack with SSL
require 'sinatra'
require 'rack-test-ext'
configure :production do
use Rack::SSL
Rack::Test::Session.custom_env['HTTPS'] = 'on'
end
assets do
css :application, [ '/css/app.css' ]
prebuild true
end
class Rack::Test::Session
def self.custom_env
@custom_env ||= {}
end
def default_env_with_custom_env
default_env_without_custom_env.merge(self.class.custom_env)
end
alias_method :default_env_without_custom_env, :default_env
alias_method :default_env, :default_env_with_custom_env
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment