path prefix is now actually a prefix
This commit is contained in:
parent
f8ee7b2e91
commit
2cfa847f6f
|
@ -37,6 +37,7 @@ class Roda
|
||||||
def proxy
|
def proxy
|
||||||
method = Faraday.method(env['REQUEST_METHOD'].downcase.to_sym)
|
method = Faraday.method(env['REQUEST_METHOD'].downcase.to_sym)
|
||||||
f_response = method.call(_proxy_url) { |req| _proxy_request(req) }
|
f_response = method.call(_proxy_url) { |req| _proxy_request(req) }
|
||||||
|
pp f_response
|
||||||
_respond(f_response)
|
_respond(f_response)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,11 +66,13 @@ class Roda
|
||||||
|
|
||||||
def _proxy_url
|
def _proxy_url
|
||||||
@_proxy_url ||= URI(roda_class.opts[:proxy_to])
|
@_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 }
|
.then { |uri| uri.query = env['QUERY_STRING']; uri }
|
||||||
end
|
end
|
||||||
|
|
||||||
def _proxy_headers
|
def _proxy_headers
|
||||||
|
pp env
|
||||||
env
|
env
|
||||||
.select { |k, _v| k.start_with? 'HTTP_' }
|
.select { |k, _v| k.start_with? 'HTTP_' }
|
||||||
.reject { |k, _v| k == 'HTTP_HOST' }
|
.reject { |k, _v| k == 'HTTP_HOST' }
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class Roda
|
class Roda
|
||||||
module Proxy
|
module Proxy
|
||||||
VERSION = '1.0.1'
|
VERSION = '1.0.2'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue