gxthrj commented on issue #878: bug: 插件热更新后,有一定几率不生效
URL: 
https://github.com/apache/incubator-apisix/issues/878#issuecomment-555401717
 
 
   > @gxthrj Can you supply a mini full source code of the plugin?
   
   ```
   local core = require("apisix.core")
   local log = require("apisix.core.log")
   local ngx = ngx
   local plugin_name = "test_plugin"
   
   local schema = {
       type = "object",
       properties = {
           origins = { type = "array", default = {"*"}},
       },
   }
   
   local _M = {
       version = 0.1,
       priority = 1000,
       name = plugin_name,
       schema = schema,
   }
   
   function _M.check_schema(conf)
       local ok, err = core.schema.check(schema, conf)
       if not ok then
           return false, err
       end
       return true
   end
   
   
   
   function _M.access(conf, ctx)
       if conf.origins[1] == "*" then -- reload前
       -- if not conf.origins or conf.origins[1] == "*" then  -- 修改后reload
           return 200
       else
           return 400
       end
   end
   
   function _M.header_filter(conf, ctx)
       log.info("header_filter")
   end
   
   return _M
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to