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/16 15:38:44 UTC

[GitHub] [apisix] tzssangglass commented on issue #4614: 请教:是否有方案支持通过判断header是否存在来路由?

tzssangglass commented on issue #4614:
URL: https://github.com/apache/apisix/issues/4614#issuecomment-881539053


   hi @jamesislebron , take a look at https://github.com/apache/apisix/blob/master/docs/en/latest/router-radixtree.md#how-to-filter-route-by-nginx-builtin-variable.
   
   here is an simple example:
   ```
   $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "uri": "/index.html",
       "vars": [
           ["http_version", "==", "1.0.0"]
       ],
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "39.97.63.215:80": 1
           }
       }
   }'
   ```
   
   This route will require the request header `version` equal `1.0.0`.


-- 
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