Skip to content

Commit

Permalink
set_upstream_uri
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw authored and dndx committed Jan 12, 2024
1 parent 18fd725 commit 7ec7a0a
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions kong/router/atc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,16 @@ local add_debug_headers = utils.add_debug_headers
local get_upstream_uri_v0 = utils.get_upstream_uri_v0


local function get_upstream_uri(req_uri, match_t)
local function set_upstream_uri(req_uri, match_t)
local matched_route = match_t.route

local request_prefix = match_t.prefix
local service_path = match_t.upstream_url_t.path
local request_prefix = match_t.prefix or "/"
local request_postfix = sanitize_uri_postfix(req_uri:sub(#request_prefix + 1))

local request_postfix = request_prefix and req_uri:sub(#request_prefix + 1) or req_uri:sub(2, -1)
request_postfix = sanitize_uri_postfix(request_postfix) or ""
local upstream_base = match_t.upstream_url_t.path or "/"

local upstream_base = service_path or "/"

local upstream_uri = get_upstream_uri_v0(matched_route, request_postfix, req_uri,
upstream_base)

return upstream_uri
match_t.upstream_uri = get_upstream_uri_v0(matched_route, request_postfix,
req_uri, upstream_base)
end


Expand Down Expand Up @@ -559,7 +554,7 @@ function _M:exec(ctx)
-- found a match

-- update upstream_uri in cache result
match_t.upstream_uri = get_upstream_uri(req_uri, match_t)
set_upstream_uri(req_uri, match_t)

-- debug HTTP request header logic
add_debug_headers(var, header, match_t)
Expand Down

0 comments on commit 7ec7a0a

Please sign in to comment.