class SiteHub::ForwardProxy
Attributes
downstream_client[R]
id[R]
mapped_path[R]
mapped_url[R]
Public Class Methods
new(sitehub_cookie_path: nil, sitehub_cookie_name:, id:, rule: nil, mapped_path:, mapped_url:)
click to toggle source
# File lib/sitehub/forward_proxy.rb, line 10 def initialize(sitehub_cookie_path: nil, sitehub_cookie_name:, id:, rule: nil, mapped_path:, mapped_url:) @downstream_client = DownstreamClient.new @sitehub_cookie_path = sitehub_cookie_path @sitehub_cookie_name = sitehub_cookie_name @id = id @rule = rule @mapped_path = mapped_path @mapped_url = mapped_url end
Public Instance Methods
call(env)
click to toggle source
# File lib/sitehub/forward_proxy.rb, line 20 def call(env) request = env[REQUEST] request.map(mapped_path, mapped_url) downstream_client.call(request).tap do |response| response.set_cookie(sitehub_cookie_name, path: resolve_sitehub_cookie_path(request), value: id) end end