membphis commented on issue #1100: bug: 浏览器发送 OPTIONS请求,无法匹配header, CURL请求没问题
URL: 
https://github.com/apache/incubator-apisix/issues/1100#issuecomment-581028414
 
 
   I made a test right now, it works fine. please take a look:
   
   ```shell
   $ curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -X PUT -d '
   {
       "uri": "/shop/auth/login",
       "methods": ["OPTIONS","POST"],
       "vars": [
           ["http_k_project", "shop"]
       ],
       "plugins": {
           "redirect": {
               "uri": "/test/default.html",
               "ret_code": 301
           }
       }
   }'
   HTTP/1.1 200 OK
   Date: Sat, 01 Feb 2020 13:02:42 GMT
   Content-Type: text/plain
   Transfer-Encoding: chunked
   Connection: keep-alive
   ... ...
   
   # expect: hit
   $ curl -I -X OPTIONS http://127.0.0.1:9080/shop/auth/login -H "K-Project: 
shop"
   HTTP/1.1 301 Moved Permanently
   Date: Sat, 01 Feb 2020 13:03:33 GMT
   Content-Type: text/html
   Content-Length: 166
   Connection: keep-alive
   Location: /test/default.html
   Server: APISIX web server
   ... ...
   
   
   # expect: not hit
   $ curl -I -X OPTIONS http://127.0.0.1:9080/shop/auth/login -H "K-Project: 
shop1"
   HTTP/1.1 404 Not Found
   Date: Sat, 01 Feb 2020 13:03:51 GMT
   Content-Type: text/plain
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX web server
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to