apisix
apisix copied to clipboard
request help: why the uri in route not work
Issue description
$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
"uri": "/helloOQ%26F8G%23J%27K%2C-f4BT%5Ba%7EN_%3A6C3UkMmgpeVyu72RjL%2A%5D%24",
"upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"}
}'
HTTP/1.1 200 OK
... ...
test
$ curl -i 'http://127.0.0.1:9080/helloOQ%26F8G%23J%27K%2C-f4BT%5Ba%7EN_%3A6C3UkMmgpeVyu72RjL%2A%5D%24'
HTTP/1.1 404 Not Found
... ...
Environment
- apisix version (cmd:
apisix version): master - OS: mac
your case is wrong. here is a correct example, @idbeta you can take a look at it:
# should use the original uri value
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
"uri": "/hello\r\n",
"upstream": {"nodes": {"127.0.0.1:9666": 1}, "type": "roundrobin"}
}'
# when we try to hit the route, we should use URL encode way. `\r` -> `%0d`, `\n` -> `%0a`
curl -i 'http://127.0.0.1:9080/hello%0d%0a'
I think we can close this issue now