From 2cfa847f6fdd684628e5d8e55730519b80d3cee4 Mon Sep 17 00:00:00 2001 From: Nigel Brookes-Thomas Date: Fri, 13 Mar 2020 12:04:07 +0000 Subject: [PATCH] path prefix is now actually a prefix --- lib/roda/proxy.rb | 5 ++++- lib/roda/proxy/version.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/roda/proxy.rb b/lib/roda/proxy.rb index f5410b3..612d7ec 100644 --- a/lib/roda/proxy.rb +++ b/lib/roda/proxy.rb @@ -37,6 +37,7 @@ class Roda def proxy method = Faraday.method(env['REQUEST_METHOD'].downcase.to_sym) f_response = method.call(_proxy_url) { |req| _proxy_request(req) } + pp f_response _respond(f_response) end @@ -65,11 +66,13 @@ class Roda def _proxy_url @_proxy_url ||= URI(roda_class.opts[:proxy_to]) - .then { |uri| uri.path = roda_class.opts[:proxy_path]; uri } + .then { |uri| uri.path = roda_class.opts[:proxy_path]; uri } # prefix + .then { |uri| uri.path += env['PATH_INFO'][1..-1]; uri } # path .then { |uri| uri.query = env['QUERY_STRING']; uri } end def _proxy_headers + pp env env .select { |k, _v| k.start_with? 'HTTP_' } .reject { |k, _v| k == 'HTTP_HOST' } diff --git a/lib/roda/proxy/version.rb b/lib/roda/proxy/version.rb index e134178..70efe72 100644 --- a/lib/roda/proxy/version.rb +++ b/lib/roda/proxy/version.rb @@ -2,6 +2,6 @@ class Roda module Proxy - VERSION = '1.0.1' + VERSION = '1.0.2' end end