Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apisix/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,8 @@ local function check_single_plugin_schema(name, plugin_conf, schema_type, skip_d
local plugin_obj = local_plugins_hash[name]
if not plugin_obj then
if skip_disabled_plugin then
core.log.warn("skipping check schema for disabled or unknown plugin ["
.. name .. "]. Enable the plugin or modify configuration")
return true
else
return false, "unknown plugin [" .. name .. "]"
Expand Down
39 changes: 39 additions & 0 deletions t/config-center-yaml/plugin.t
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ _EOC_
my $routes = <<_EOC_;
routes:
- uri: /hello
plugins:
ip-restriction:
whitelist:
- "127.0.0.1"
upstream:
nodes:
"127.0.0.1:1980": 1
Expand Down Expand Up @@ -227,3 +231,38 @@ hello world
use config_provider: yaml
load(): new plugins: {}
load_stream(): new plugins: {}



=== TEST 7: route with plugin not in plugins list
--- yaml_config
apisix:
node_listen: 1984
enable_admin: false
deployment:
role: data_plane
role_data_plane:
config_provider: yaml
plugins:
--- debug_config eval: $::debug_config
--- config
location /t {
content_by_lua_block {
ngx.sleep(0.3)
local http = require "resty.http"
local httpc = http.new()
local uri = "http://127.0.0.1:" .. ngx.var.server_port .. "/hello"
local res, err = httpc:request_uri(uri, {
method = "GET",
})
ngx.print(res.body)
}
}
--- request
GET /t
--- response_body
hello world
--- no_error_log
[error]
--- error_log
skipping check schema for disabled or unknown plugin [ip-restriction]. Enable the plugin or modify configuration
Loading