Class: Ritm::Proxy::SSLReverseProxy
- Inherits:
-
Object
- Object
- Ritm::Proxy::SSLReverseProxy
- Defined in:
- lib/ritm/proxy/ssl_reverse_proxy.rb
Overview
SSL Intercept reverse proxy server. Supports interception of https request and responses It does man-in-the-middle with on-the-fly certificate signing using the given CA
Instance Method Summary collapse
-
#initialize(port, ca, conf, request_interceptor: nil, response_interceptor: nil) ⇒ SSLReverseProxy
constructor
Creates a HTTPS server with the given settings.
- #shutdown ⇒ Object
- #start_async ⇒ Object
Constructor Details
#initialize(port, ca, conf, request_interceptor: nil, response_interceptor: nil) ⇒ SSLReverseProxy
Creates a HTTPS server with the given settings
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ritm/proxy/ssl_reverse_proxy.rb', line 16 def initialize(port, ca, conf, request_interceptor: nil, response_interceptor: nil) @ca = ca default_vhost = 'localhost' @server = CertSigningHTTPSServer.new(Port: port, AccessLog: [], Logger: WEBrick::Log.new(File.open(File::NULL, 'w')), ca: ca, **vhost_settings(default_vhost)) @server.mount '/', RequestInterceptorServlet, request_interceptor, response_interceptor, conf end |
Instance Method Details
#shutdown ⇒ Object
34 35 36 |
# File 'lib/ritm/proxy/ssl_reverse_proxy.rb', line 34 def shutdown @server.shutdown end |
#start_async ⇒ Object
28 29 30 31 32 |
# File 'lib/ritm/proxy/ssl_reverse_proxy.rb', line 28 def start_async trap(:TERM) { shutdown } trap(:INT) { shutdown } Thread.new { @server.start } end |