Skip to content

Commit 9f0f6cb

Browse files
feat(router) add normalize-req-uri parameter
Use a self parameter(normalize_req_uri) of kong.router to load the new parameter. It will be easier to add a new route parameter to control the URI normalization behavior in the future. New feature for Kong#7913
1 parent 34b2a3c commit 9f0f6cb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

kong/router.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,7 @@ function _M.new(routes)
18201820

18211821
self.select = find_route
18221822
self._set_ngx = _set_ngx
1823+
self.normalize_req_uri = routes.normalize_req_uri
18231824

18241825
if subsystem == "http" then
18251826
function self.exec(ctx)
@@ -1848,8 +1849,7 @@ function _M.new(routes)
18481849
req_uri = sub(req_uri, 1, idx - 1)
18491850
end
18501851

1851-
local normalize_req_uri = kong.configuration.normalize_req_uri
1852-
if normalize_req_uri == "on" then
1852+
if self.normalize_req_uri == "on" then
18531853
req_uri = normalize(req_uri, true)
18541854
end
18551855
end

kong/runloop/handler.lua

+1
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ do
688688
build_router = function(version)
689689
local db = kong.db
690690
local routes, i = {}, 0
691+
routes.normalize_req_uri = kong.configuration.normalize_req_uri
691692

692693
local err
693694
-- The router is initially created on init phase, where kong.core_cache is

0 commit comments

Comments
 (0)