Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bungle committed Apr 14, 2017
1 parent 1d85424 commit 7292b55
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions kong/core/router.lua
Original file line number Diff line number Diff line change
Expand Up @@ -615,17 +615,23 @@ function _M.new(apis)


function self.exec(ngx)
local method = ngx.req.get_method()
local uri = ngx.var.request_uri
local uri_root = uri == "/"
local new_uri
local host_header
local req_host
local method = ngx.req.get_method()
local uri = ngx.var.request_uri


do
local s = find(uri, "?", 2, true)
if s then
uri = sub(uri, 1, s - 1)
end
end


--print("grab host header: ", grab_host)


local req_host

if grab_host then
req_host = ngx.var.http_host
end
Expand All @@ -636,26 +642,18 @@ function _M.new(apis)
return nil
end

local new_uri
local uri_root = uri == "/"

if uri_root then
if uri_root or not api_t.strip_uri_regex then
new_uri = uri

else
local s = find(uri, "?", 2, true)
if s then
uri = sub(uri, 1, s - 1)
end

if not api_t.strip_uri_regex then
new_uri = uri

else
local err
new_uri, err = re_sub(uri, api_t.strip_uri_regex, "/$1", "ajo")
if not new_uri then
log(ERR, "could not strip URI: ", err)
return
end
local err
new_uri, err = re_sub(uri, api_t.strip_uri_regex, "/$1", "ajo")
if not new_uri then
log(ERR, "could not strip URI: ", err)
return
end
end

Expand Down Expand Up @@ -691,6 +689,8 @@ function _M.new(apis)
end


local host_header

if api_t.preserve_host then
host_header = req_host or ngx.var.http_host
end
Expand Down

0 comments on commit 7292b55

Please sign in to comment.