orlabs / orange

OpenResty/Nginx Gateway for API Monitoring and Management.
http://orange.sumory.com
MIT License
2.31k stars 574 forks source link

v0.8.1 api创建 waf 的 selector 失败 #400

Open ruicky opened 4 years ago

ruicky commented 4 years ago
使用的Orange版本

v0.8.1

需求或场景

使用 api 添加 waf selector

使用的插件

无,涉及waf

具体的配置
curl http://localhost:7777/waf/selectors -X POST -d '
{
    "name": "waf-selectors",
    "type": 0,
    "judge": {},
    "handle": {
        "continue": true,
        "log": false
    },
    "enable": true
}' 
期望的结果

期望能够创建成功 selector

错误的结果

api_error.log 如下:

[error] 5248#5248: *4905 [lua] server.lua:76: func(): .../deps/share/lua/5.1/orange/orange/plugins/common_api.lua:513: attempt to index local 'selector' (a nil value)
stack traceback:
    /usr/local/lor/lor/lib/router/router.lua:204: in function '__newindex'
    .../deps/share/lua/5.1/orange/orange/plugins/common_api.lua:513: in function 'func'
    /usr/local/lor/lor/lib/router/router.lua:192: in function </usr/local/lor/lor/lib/router/router.lua:191>
    [C]: in function 'xpcall'
    /usr/local/lor/lor/lib/router/router.lua:191: in function 'func'
    /usr/local/lor/lor/lib/router/router.lua:192: in function </usr/local/lor/lor/lib/router/router.lua:191>
    [C]: in function 'xpcall'
    /usr/local/lor/lor/lib/router/router.lua:191: in function 'next'
    /usr/local/lor/lor/lib/router/router.lua:213: in function 'handle'
    /usr/local/lor/lor/lib/application.lua:95: in function </usr/local/lor/lor/lib/application.lua:94>
    [C]: in function 'xpcall'
    /usr/local/lor/lor/lib/application.lua:94: in function 'handle'
    /usr/local/lor/lor/lib/application.lua:54: in function 'run'
    content_by_lua(nginx.conf:154):3: in main chunk, client: 10.254.111.40, server: , request: "POST /waf/selectors HTTP/1.1", host: "127.0.0.1:7777"