From 4de32e602c6e5b627d2a802a6d2da206148fe249 Mon Sep 17 00:00:00 2001 From: Mike Eller Date: Wed, 18 Oct 2023 20:08:59 +0100 Subject: [PATCH 1/2] Updated for kong 3.x base_plugin has been deprecated in the latest version --- kong/plugins/path-prefix/handler.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/kong/plugins/path-prefix/handler.lua b/kong/plugins/path-prefix/handler.lua index 43b2768..c6edd6a 100644 --- a/kong/plugins/path-prefix/handler.lua +++ b/kong/plugins/path-prefix/handler.lua @@ -1,8 +1,7 @@ -local plugin = require("kong.plugins.base_plugin"):extend() - -function plugin:new() - plugin.super.new(self, "path-prefix") -end +local plugin = { + PRIORITY = 800, + VERSION = "1.0.0" +} local function escape_hyphen(conf) local path_prefix = conf.path_prefix @@ -45,6 +44,4 @@ function plugin:access(plugin_conf) kong.service.request.set_path(new_path) end -plugin.PRIORITY = 800 - return plugin From a8e398b347a23e27a19b9e09853444ef878ea309 Mon Sep 17 00:00:00 2001 From: Mike Eller Date: Wed, 18 Oct 2023 20:24:38 +0100 Subject: [PATCH 2/2] Update handler.lua --- kong/plugins/path-prefix/handler.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/kong/plugins/path-prefix/handler.lua b/kong/plugins/path-prefix/handler.lua index c6edd6a..4368efb 100644 --- a/kong/plugins/path-prefix/handler.lua +++ b/kong/plugins/path-prefix/handler.lua @@ -23,8 +23,6 @@ local function add_header(conf, path) end function plugin:access(plugin_conf) - plugin.super.access(self) - local service_path = ngx.ctx.service.path or "" local full_path = kong.request.get_path() local replace_match = escape_hyphen(plugin_conf)