waterlink / rack-reverse-proxy

A Reverse Proxy for Rack
MIT License
196 stars 52 forks source link

adds an option to set OpenSSL verify mode #24

Closed MrMarvin closed 8 years ago

MrMarvin commented 8 years ago

With this PR it is possible to explicitly disable tls certificate verification in case your origin servers use invalid / self signed certificates.

Example usage:

marathon_uri = URI.parse(ENV['MARATHON_URL'])
args_for_reverse_proxy = {}
args_for_reverse_proxy[:username] = marathon_uri.user if marathon_uri.user
args_for_reverse_proxy[:password] = marathon_uri.password if marathon_uri.password
args_for_reverse_proxy[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if ENV['MARATHON_INSECURE']

proxy = Rack::ReverseProxy.new do
  reverse_proxy /^\/proxy\/?(.*)$/, ENV['MARATHON_URL']+'/'+'$1', args_for_reverse_proxy
end
waterlink commented 8 years ago

Thanks, I will fix the failing builds (gem updated) and will try to add test for this code, and merge afterwards.

waterlink commented 8 years ago

Merged as a part of #25