Skip to content

Commit

Permalink
fix(resolver) handling edgecase resulting in wrong URI
Browse files Browse the repository at this point in the history
- If querying `/path/foo` with `strip_path=true`, then the resolver
  would replace the URI with `//foo`.
  • Loading branch information
thibaultcha committed Jun 3, 2015
1 parent 73e2eb4 commit 2a88978
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kong/resolver/access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ function _M.execute(conf)

-- If API was retrieved by path
if by_path and api.strip_path then
-- All paths are '/path', so let's replace it with a single '/'
request_uri = string.gsub(request_uri, api.path, "/")
-- Replace `/path` with `path`, and then prefix with a `/`
-- Or replace `/path/foo` with `/foo`, and then do not prefix with `/`.
request_uri = string.gsub(request_uri, api.path, "")
if string.sub(request_uri, 0, 1) ~= "/" then
request_uri = "/"..request_uri
end
end

-- Setting the backend URL for the proxy_pass directive
Expand Down

0 comments on commit 2a88978

Please sign in to comment.