apisix icon indicating copy to clipboard operation
apisix copied to clipboard

request help: setted a special uri in route,when request it,it return 404

Open idbeta opened this issue 6 years ago • 2 comments

Issue description

$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
 "uri": "/helloh~E]ftXnj2Hs#r9&Rg:Y/;o-OI,uN7Le!P_J+w.zi4C0aDA3WMqU1T*KVZ?GmdFlQ5", 
 "upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"}
}' 

HTTP/1.1 200 OK
Date: Sat, 10 Oct 2020 08:22:37 GMT
Content-Type: application/json
... ...

but when I request the URI

$ curl http://127.0.0.1:9080/helloh~E]ftXnj2Hs#r9&Rg:Y/;o-OI,uN7Le!P_J+w.zi4C0aDA3WMqU1T*KVZ?GmdFlQ5
.... 
# it returned 404

Environment

  • apisix version (cmd: apisix version): master
  • OS:

idbeta avatar Oct 10 '20 06:10 idbeta

http://127.0.0.1:9080/helloh~E]ftXnj2Hs#r9&Rg:Y/;o-OI,uN7Le!P_J+w.zi4C0aDA3WMqU1T*KVZ?GmdFlQ5

it is not a valid URI address, the Admin API should return 400 for this case.

it can not contain #.

membphis avatar Oct 10 '20 08:10 membphis

a correct test case:

$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
 "uri": "/helloh~E]ftXnj2Hs",
 "upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"}
}'

$ curl -i 'http://127.0.0.1:9080/helloh~E%5DftXnj2Hs'
HTTP/1.1 200 Bad Gateway
Date: Sun, 11 Oct 2020 08:04:45 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 154
... ...

membphis avatar Oct 11 '20 08:10 membphis