You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/12/15 08:47:05 UTC
[GitHub] [apisix] zhangyiyou5 edited a comment on issue #5796: bug: The traffic split plug-in runs and reports an error according to the official configuration
zhangyiyou5 edited a comment on issue #5796:
URL: https://github.com/apache/apisix/issues/5796#issuecomment-994503755
@nic-chen
> @zhangyiyou5 could you show the config of the route stored in ETCD?
```
{
"id": "378538034242519755",
"create_time": 1635155850,
"update_time": 1639471131,
"uri": "/zendesk/*",
"name": "zendesk",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"script": "local core = require(\"apisix.core\")\nlocal plugin = require(\"apisix.plugin\")\nlocal tablepool = core.tablepool\n\n\nlocal _M = {}\n\n\n_M.conf_e7dff882_6ea8_4c39_b167_2ef655e4de6e = core.json.decode(\n [[{\"disable\":false,\"rules\":[{\"match\":[{\"vars\":[[\"arg_shop\",\"==\",\"aa\"]]}],\"weighted_upstreams\":[{\"upstream\":{\"name\":\"upstream_A\",\"nodes\":{\"uat-open-app-ads.uat.svc.cluster.local:8080\":10},\"type\":\"roundrobin\"}}]}]}]]\n)\nlocal traffic_split = plugin.get(\"traffic-split\")\nlocal function func_rule_e7dff882_6ea8_4c39_b167_2ef655e4de6e(ctx)\n local phase_fun = traffic_split.access or traffic_split.rewrite\n local plugins = ctx.script_plugins\n\n local code, body = phase_fun(_M.conf_e7dff882_6ea8_4c39_b167_2ef655e4de6e, ctx)\n core.table.insert(plugins, \"traffic-split\")\n core.table.insert(plugins, \"conf_e7dff882_6ea8_4c39_b167_2ef655e4de6e\")\n return _M.func_rule_84700f3e_7edc_4552_892f_62d3e72483be(ctx)\nend\n_M.func_rule_e7
dff882_6ea8_4c39_b167_2ef655e4de6e = func_rule_e7dff882_6ea8_4c39_b167_2ef655e4de6e\n\n\n_M.conf_84700f3e_7edc_4552_892f_62d3e72483be = core.json.decode(\n [[{\"disable\":false,\"regex_uri\":[\"^/zendesk/(.*)\",\"/$1\"],\"scheme\":\"http\"}]]\n)\nlocal proxy_rewrite = plugin.get(\"proxy-rewrite\")\nlocal function func_rule_84700f3e_7edc_4552_892f_62d3e72483be(ctx)\n local plugins = ctx.script_plugins\n\n local phase_fun = proxy_rewrite.access or proxy_rewrite.rewrite\n if phase_fun then\n local code, body = phase_fun(_M.conf_84700f3e_7edc_4552_892f_62d3e72483be, ctx)\n if code or body then\n core.response.exit(code, body)\n end\n end\n core.table.insert(plugins, \"proxy-rewrite\")\n core.table.insert(plugins, \"conf_84700f3e_7edc_4552_892f_62d3e72483be\")\n return\nend\n_M.func_rule_84700f3e_7edc_4552_892f_62d3e72483be = func_rule_84700f3e_7edc_4552_892f_62d3e72483be\n\n\n_M.access = function(ctx)\n ctx.script_plugins = {}\n return func_rule_e7dff882_6ea8_4
c39_b167_2ef655e4de6e(ctx)\nend\n\n\n_M.header_filter = function(ctx)\nlocal plugins = ctx.script_plugins\nfor i = 1, #plugins, 2 do\n local plugin_name = plugins[i]\n local plugin_conf_name = plugins[i + 1]\n local plugin_obj = plugin.get(plugin_name)\n local phase_fun = plugin_obj.header_filter\n if phase_fun then\n phase_fun(_M[plugin_conf_name], ctx)\n end\nend\nend\n\n\n_M.body_filter = function(ctx)\nlocal plugins = ctx.script_plugins\nfor i = 1, #plugins, 2 do\n local plugin_name = plugins[i]\n local plugin_conf_name = plugins[i + 1]\n local plugin_obj = plugin.get(plugin_name)\n local phase_fun = plugin_obj.body_filter\n if phase_fun then\n phase_fun(_M[plugin_conf_name], ctx)\n end\nend\nend\n\n\n_M.log = function(ctx)\nlocal plugins = ctx.script_plugins\nfor i = 1, #plugins, 2 do\n local plugin_name = plugins[i]\n local plugin_conf_name = plugins[i + 1]\n local plugin_obj = plugin.get(plugin_name)\n local phase_
fun = plugin_obj.log\n if phase_fun then\n phase_fun(_M[plugin_conf_name], ctx)\n end\nend\ntablepool.release(\"script_plugins\", ctx.script_plugins)\nend\n\n\nreturn _M\n",
"script_id": "378538034242519755",
"upstream_id": "378525802326655755",
"status": 1
}
```
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org