gxthrj opened a new issue #4547:
URL: https://github.com/apache/apisix/issues/4547


   ### Issue description
   If URI contains %0A, will cause route match failed.
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.6
   
   ### Minimal test code / Steps to reproduce the issue
   
   Bug report without steps to reproduce will be ignored or closed.
   
   1. create a route
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/31 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "uri": "*",
       "hosts": ["foo.com"],
       "methods": ["PUT", "GET"],
       "enable_websocket": true,
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "httpbin.org": 1
           }
       }
   }'
   ```
   2. have a try with normal request
   ```
   curl -i http://127.0.0.1:9080/ip -H "Host:foo.com"
   ```
   It will be success.
   
   ```
   HTTP/1.1 200 OK
   Content-Type: application/json
   Content-Length: 45
   Connection: keep-alive
   Date: Tue, 06 Jul 2021 14:47:10 GMT
   Access-Control-Allow-Origin: *
   Access-Control-Allow-Credentials: true
   Server: APISIX/2.6
   
   {
     "origin": "172.19.0.1, 114.220.17.103"
   }
   ```
   3. If URI contains %0A
   ```
   curl -i http://127.0.0.1:9080/ip%0AVega -H "Host:foo.com"
   ```
   will get 404
   ```
   HTTP/1.1 404 Not Found
   Date: Tue, 06 Jul 2021 14:35:51 GMT
   Content-Type: text/plain; charset=utf-8
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX/2.6
   
   {"error_msg":"404 Route Not Found"}
   ```
   
   ### What's the expected result?
   Expect normal routing, and upstream returns 404
   ```
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
   <title>404 Not Found</title>
   <h1>Not Found</h1>
   <p>The requested URL was not found on the server.  If you entered the URL 
manually please check your spelling and try again.</p>
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to