File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class ReverseProxy
6
6
def initialize ( app = nil , &b )
7
7
@app = app || lambda { [ 404 , [ ] , [ ] ] }
8
8
@paths = { }
9
- @opts = { :preserve_host => false }
9
+ @opts = { :preserve_host => false , :verify_ssl => true }
10
10
instance_eval &b if block_given?
11
11
end
12
12
@@ -25,8 +25,16 @@ def call(env)
25
25
headers [ 'HOST' ] = uri . host if @opts [ :preserve_host ]
26
26
27
27
session = Net ::HTTP . new ( uri . host , uri . port )
28
+
28
29
session . use_ssl = ( uri . scheme == 'https' )
29
- session . verify_mode = OpenSSL ::SSL ::VERIFY_NONE
30
+
31
+ if uri . scheme == 'https' && @opts [ :verify_ssl ]
32
+ session . verify_mode = OpenSSL ::SSL ::VERIFY_PEER
33
+ else
34
+ # DO NOT DO THIS IN PRODUCTION !!!
35
+ session . verify_mode = OpenSSL ::SSL ::VERIFY_NONE
36
+ end
37
+
30
38
session . start { |http |
31
39
m = rackreq . request_method
32
40
case m
You can’t perform that action at this time.
0 commit comments