bug: 404 route not found if URI contains %0A
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.
- 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
}
}
}'
- 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"
}
- 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>
What is the exact behavior if you access the upstream directly with this URL?
What is the exact behavior if you access the upstream directly with this URL?
It has been written here.

What is the exact behavior if you access the upstream directly with this URL?
It has been written here.
I mean, don't use APISIX as the proxy.
Look like it is a bug in the route match library.
What is the exact behavior if you access the upstream directly with this URL?
It has been written here.
I mean, don't use APISIX as the proxy.
Using Nginx, it will return from upstream. Because the location is '*'.
Look like it is a bug in the route match library.
Yep
Is there an easy fix for this? When can we expect a fix?
fixed: https://github.com/api7/lua-resty-radixtree/pull/99
Great~
need to use new version before closing this issue. my bad