Module: SSLGate::HeadersModAddOn
- Defined in:
- lib/ssl_gate/headers_mod.rb
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ssl_gate/headers_mod.rb', line 5 def call(env) prev = env['async.callback'] env['async.callback'] = lambda { |*args| # puts 'I see you' prev.call(*args) } headers = env.select { |k, _v| k.start_with? 'HTTP_' } .collect { |key, val| [key.sub(/^HTTP_/, '').gsub('_', '-'), val] } .to_h headers.delete 'HOST' headers.delete 'USER-AGENT' headers['REFERER'].sub! %r{^https?://[^/]+(:\d+)?}, @config[:target] if headers['REFERER'] super env end |
#initialize(config) ⇒ Object
20 21 22 23 |
# File 'lib/ssl_gate/headers_mod.rb', line 20 def initialize(config) super # subst_host: 'name' end |