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/07/17 06:55:05 UTC
[GitHub] [apisix] tzssangglass edited a comment on issue #4614: 请教:是否有方案支持通过判断header是否存在来路由?
tzssangglass edited a comment on issue #4614:
URL: https://github.com/apache/apisix/issues/4614#issuecomment-881844980
I think what you mean is `in` operator, you can also take a look at : https://github.com/api7/lua-resty-expr#operator-list
simple example:
```
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/hello",
"vars": [
["http_version", "in", ["1.0.0"]]
],
"upstream": {
"nodes": {
"127.0.0.1:1980": 1
},
"type": "roundrobin"
}
}'
```
this request will be caught by the route
```
curl -H 'version: 1.0.0' 127.0.0.1:9080/hello
```
this request will not be caught by the route
```
curl -H 'version: 1.0.1' 127.0.0.1:9080/hello
```
--
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