From c9336a23d31f9578ecb817c5feca4bb3dd27beda Mon Sep 17 00:00:00 2001 From: Kyle Lacy Date: Mon, 29 Jan 2018 15:37:22 -0800 Subject: [PATCH] Tweak Rack request header initialization --- lib/reverse_proxy/client.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/reverse_proxy/client.rb b/lib/reverse_proxy/client.rb index bb8c72c..b752f64 100644 --- a/lib/reverse_proxy/client.rb +++ b/lib/reverse_proxy/client.rb @@ -51,13 +51,11 @@ module ReverseProxy # We can pass in a custom path uri = Addressable::URI.parse("#{url}#{options[:path] || env['ORIGINAL_FULLPATH']}") - # Initialize request - target_request = Net::HTTP.const_get(source_request.request_method.capitalize).new(uri.request_uri) - - # Setup headers + # Define headers target_request_headers = extract_http_request_headers(source_request.env).merge(options[:headers]) - target_request.initialize_http_header(target_request_headers) + # Initialize request + target_request = Net::HTTP.const_get(source_request.request_method.capitalize).new(uri.request_uri, target_request_headers) # Basic auth target_request.basic_auth(options[:username], options[:password]) if options[:username] and options[:password]