插件说明与使用介绍 属性 名称 类型 必选项 默认值 有效值 描述 domain Object 可选 domain域的重写配置 domain use boolen 可选 false [false, true] domain regex string domain replacement string path Object 可选 path域的重写配置 path use boolen 可选 false [false, true] path regex string path replacement string 如何启用 在配置窗口页以 YAML 格式填写。 配置示例 1. 样例 配置proxycookie插件内容,关闭domain,开启path。 curl H 'XAPIKEY: 2571e288e8f4cd273cab342440068469' X PUT d ' { "name": "test", "uri": "/hello", "plugins": { "proxycookie": { "domain": { "use": false }, "path": { "regex": "/c/app", "use": true, "replacement": "/" }, "disable": true } }, "upstream": { "type": "roundrobin", "nodes": { "127.0.0.1:39087": 1 } } }' 2. 示例场景 以Path属性为例,Domain属性同理。 测试场景1:当setcookie中不存在Path属性时 用例11:属性关闭 即 proxycookiepath {usefalse}, 表示不对Path属性进行重写 用例12:属性开启 proxycookiepath {usetrue, regex"/app/a/b", replacement"/a/b"}, 表示不对Path属性进行重写 proxycookiepath {usetrue, regex"^/app/a/b", replacement"/a/b"}, 表示不对Path属性进行重写 测试场景2:当setcookie中存在Path属性时 如setcookie: Path/c/app/a/b 用例21 属性关闭 即 proxycookiepath {usefalse}, 表示不对Path属性进行重写 用例22 属性开启 proxycookiepath {usetrue, regex"/app/a/b", replacement"/a/b"},表示对Path属性进行重写,重写后,setcookie: Path/c/a/b proxycookiepath {usetrue, regex"/a/b", replacement"/a/b"}, 表示对Path属性进行重写,重写后,setcookie: Path/a/b proxycookiepath {usetrue, regex"c/a/b", replacement"/a/b"}, 表示对Path属性进行重写,重写后(未匹配时,原样输出),setcookie: Path/c/app/a/b