Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

分流插件中使用,Header中获取key时,key包含下划线_导致value获取失败 #409

Open
sydowma opened this issue Mar 1, 2020 · 2 comments

Comments

@sydowma
Copy link
Contributor

sydowma commented Mar 1, 2020

针对Orange使用的提问,对于简单几句话描述不清的问题,请使用以下格式,不符合格式或描述含糊不清的issue将不予回复。根据问题模板填写好后,提问之前请去除模板的无用内容。

使用的Orange版本

v0.8.1

需求或场景

使用分流插件,获取使用 Header 中的key来判断是否要分流

使用的插件

分流插件-divide

具体的配置

image

{   "name": "hello1",   "judge": {     "type": 0,     "conditions": [       {         "type": "Header",         "name": "work_code",         "operator": "=",         "value": "11111"       }     ]   },   "extractor": {     "type": 1,     "extractions": []   },   "upstream_host": "",   "upstream_url": "http://default_upstream",   "log": true,   "enable": true }

2020/03/01 19:32:09 [info] 12533#12533: *10652 [lua] handler.lua:95: access(): ==[Divide][PASS THROUGH SELECTOR:e4ed6bee-4666-47d0-a780-1a6c1a648ad8], client: 124.xx.xx.xx, server: , request: "GET / HTTP/1.1", host: "www.baidu.com"
2020/03/01 19:32:09 [info] 12533#12533: *10652 [lua] handler.lua:107: access(): [Divide][PASS-SELECTOR:e4ed6bee-4666-47d0-a780-1a6c1a648ad8] /, client: xx.xx.xx.xx, server: , request: "GET / HTTP/1.1", host: "www.baidu.com"
2020/03/01 19:32:09 [error] 12533#12533: *10652 [lua] condition.lua:10: judge(): assert_condition error: nil = 111111, client: xx.xx.xx.xx, server: , request: "GET / HTTP/1.1", host: "www.baidu.com"
2020/03/01 19:32:09 [info] 12533#12533: *10652 [lua] handler.lua:60: filter_rules(): [Divide-NotMatch-Rule] hello1 host:www.baidu.com uri:/, client: xx.xx.xx.xx, server: , request: "GET / HTTP/1.1", host: "www.baidu.com"
2020/03/01 19:32:09 [info] 12533#12533: *10652 [lua] handler.lua:37: filter_rules(): [Divide-Match-Rule] default host:www.baidu.com uri:/, client: xx.xx.xx.xx, server: , request: "GET / HTTP/1.1", host: "www.baidu.com"
2020/03/01 19:32:09 [info] 12533#12533: *10652 [lua] handler.lua:51: filter_rules(): [Divide-Match-Rule:upstream] default extractor_type:1 upstream_host:www.baidu.com upstream_url:http://baidu, client: xx.xx.xx.xx, server: , request: "GET / HTTP/1.1", host: "www.baidu.com"

将key中间的下划线删掉后,问题恢复。

@sydowma
Copy link
Contributor Author

sydowma commented Mar 6, 2020

@wujunze @shuaijinchao 大佬帮忙看一下

@shz8
Copy link

shz8 commented May 7, 2020

在usr/local/orange/conf/nginx.conf 的 http{} 里加一行 underscores_in_headers on;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants