Merge pull request #12 from axsuul/feature/verify_ssl
Add option to verify SSL
This commit is contained in:
commit
ff96ff813a
|
@ -58,6 +58,12 @@ You can also pass options into `reverse_proxy`
|
|||
reverse_proxy "http://localhost:8000", path: "custom-path", headers: { 'X-Foo' => "Bar" }
|
||||
```
|
||||
|
||||
If you'd like to bypass SSL verification
|
||||
|
||||
```ruby
|
||||
reverse_proxy "http://localhost:8000", verify_ssl: false
|
||||
```
|
||||
|
||||
Use this method to determine what version you're running
|
||||
|
||||
```ruby
|
||||
|
|
|
@ -37,10 +37,11 @@ module ReverseProxy
|
|||
|
||||
def request(env, options = {}, &block)
|
||||
options.reverse_merge!(
|
||||
headers: {},
|
||||
path: nil,
|
||||
username: nil,
|
||||
password: nil
|
||||
headers: {},
|
||||
path: nil,
|
||||
username: nil,
|
||||
password: nil,
|
||||
verify_ssl: true
|
||||
)
|
||||
|
||||
source_request = Rack::Request.new(env)
|
||||
|
@ -78,8 +79,12 @@ module ReverseProxy
|
|||
# within Varnish (503)
|
||||
target_request['Accept-Encoding'] = nil
|
||||
|
||||
http_options = {}
|
||||
http_options[:use_ssl] = (uri.scheme == "https")
|
||||
http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if options[:verify_ssl]
|
||||
|
||||
# Make the request
|
||||
Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == "https"), :verify_mode: => OpenSSL::SSL::VERIFY_NONE) do |http|
|
||||
Net::HTTP.start(uri.hostname, uri.port, http_options) do |http|
|
||||
target_response = http.request(target_request)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue