Feature: Added attributes of Net::HTTP
To support wide variety of attributes provides by Net::HTTP class.
This commit is contained in:
parent
2584b7ae91
commit
afc4e2664e
|
@ -64,6 +64,12 @@ If you'd like to bypass SSL verification
|
||||||
reverse_proxy "http://localhost:8000", verify_ssl: false
|
reverse_proxy "http://localhost:8000", verify_ssl: false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you'd like to more customize your [HTTP optional hash](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html#start-method),
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
reverse_proxy "http://localhost:8000", http_options: {read_timeout: 20, open_timeout: 100}
|
||||||
|
```
|
||||||
|
|
||||||
Use this method to determine what version you're running
|
Use this method to determine what version you're running
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -88,4 +94,3 @@ Special thanks to our contributors!
|
||||||
|
|
||||||
Copyright (c) 2016 James Hu. See [LICENSE](LICENSE) for
|
Copyright (c) 2016 James Hu. See [LICENSE](LICENSE) for
|
||||||
further details.
|
further details.
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ module ReverseProxy
|
||||||
def request(env, options = {}, &block)
|
def request(env, options = {}, &block)
|
||||||
options.reverse_merge!(
|
options.reverse_merge!(
|
||||||
headers: {},
|
headers: {},
|
||||||
|
http_options: {},
|
||||||
path: nil,
|
path: nil,
|
||||||
username: nil,
|
username: nil,
|
||||||
password: nil,
|
password: nil,
|
||||||
|
@ -82,6 +83,7 @@ module ReverseProxy
|
||||||
http_options = {}
|
http_options = {}
|
||||||
http_options[:use_ssl] = (uri.scheme == "https")
|
http_options[:use_ssl] = (uri.scheme == "https")
|
||||||
http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if options[:verify_ssl]
|
http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if options[:verify_ssl]
|
||||||
|
http_options.merge!(options[:http_options]) if options[:http_options]
|
||||||
|
|
||||||
# Make the request
|
# Make the request
|
||||||
Net::HTTP.start(uri.hostname, uri.port, http_options) do |http|
|
Net::HTTP.start(uri.hostname, uri.port, http_options) do |http|
|
||||||
|
|
Loading…
Reference in New Issue