Class: Conjur::WebServer::APIProxy::Request

Inherits:
Rack::StreamingProxy::Request
  • Object
show all
Defined in:
lib/conjur/webserver/api_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/conjur/webserver/api_proxy.rb', line 8

def initialize env
  path = env["PATH_INFO"]

  path =~ /^\/([^\/]+)(.*)/
  app = $1
  path_remainder = $2

  new_url = case app
  when 'authn', 'authz', 'audit', 'pubkeys'
    [ Conjur.configuration.send("#{app}_url"), path_remainder ].join
  else
    [ Conjur.configuration.send("core_url"), path ].join
  end
  if query = env["QUERY_STRING"]
    new_url = [ new_url, query ].join('?')
  end

  super new_url.to_s, Rack::Request.new(env)
end