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" }
|
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
|
Use this method to determine what version you're running
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
|
|
@ -40,7 +40,8 @@ module ReverseProxy
|
||||||
headers: {},
|
headers: {},
|
||||||
path: nil,
|
path: nil,
|
||||||
username: nil,
|
username: nil,
|
||||||
password: nil
|
password: nil,
|
||||||
|
verify_ssl: true
|
||||||
)
|
)
|
||||||
|
|
||||||
source_request = Rack::Request.new(env)
|
source_request = Rack::Request.new(env)
|
||||||
|
@ -78,8 +79,12 @@ module ReverseProxy
|
||||||
# within Varnish (503)
|
# within Varnish (503)
|
||||||
target_request['Accept-Encoding'] = nil
|
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
|
# 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)
|
target_response = http.request(target_request)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue