Class: Ritm::Proxy::ProxyServer
- Inherits:
-
WEBrick::HTTPProxyServer
- Object
- WEBrick::HTTPProxyServer
- Ritm::Proxy::ProxyServer
- Defined in:
- lib/ritm/proxy/proxy_server.rb
Overview
Proxy server that accepts request and response intercept handlers for HTTP traffic HTTPS traffic is redirected to the SSLReverseProxy for interception
Instance Method Summary collapse
-
#do_CONNECT(req, res) ⇒ Object
Override Patches the destination address on HTTPS connections to go via the HTTPS Reverse Proxy.
-
#proxy_service(req, res) ⇒ Object
Override Handles HTTP (no SSL) traffic interception.
-
#proxy_uri(req, _res) ⇒ Object
Override.
- #start_async ⇒ Object
Instance Method Details
#do_CONNECT(req, res) ⇒ Object
Override Patches the destination address on HTTPS connections to go via the HTTPS Reverse Proxy
18 19 20 21 |
# File 'lib/ritm/proxy/proxy_server.rb', line 18 def do_CONNECT(req, res) req.unparsed_uri = @config[:https_forward] unless ssl_pass_through? req.unparsed_uri super end |
#proxy_service(req, res) ⇒ Object
Override Handles HTTP (no SSL) traffic interception
25 26 27 28 29 |
# File 'lib/ritm/proxy/proxy_server.rb', line 25 def proxy_service(req, res) # Proxy Authentication proxy_auth(req, res) @config[:forwarder].forward(req, res) end |
#proxy_uri(req, _res) ⇒ Object
Override
32 33 34 35 36 37 38 39 40 |
# File 'lib/ritm/proxy/proxy_server.rb', line 32 def proxy_uri(req, _res) if req.request_method == 'CONNECT' # Let the reverse proxy handle upstream proxies for https nil else proxy = @config[:ritm_conf].misc.upstream_proxy proxy.nil? ? nil : URI.parse(proxy) end end |
#start_async ⇒ Object
10 11 12 13 14 |
# File 'lib/ritm/proxy/proxy_server.rb', line 10 def start_async trap(:TERM) { shutdown } trap(:INT) { shutdown } Thread.new { start } end |