docs: getting-started-ip example doesn't work the api consumer request returns 404
Current State
The documentation on this page: https://apisix.apache.org/docs/apisix/getting-started/configure-routes/
states to use
curl -i "http://127.0.0.1:9180/apisix/admin/routes" -X PUT -d '
{
"id": "getting-started-ip",
"uri": "/ip",
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'
when i use that and then run
curl "http://127.0.0.1:9080/ip"
I get
<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>
Desired State
I think the admin request should use 443 because that works
curl -i "http://127.0.0.1:9180/apisix/admin/routes" -X PUT -d '
{
"id": "getting-started-ip",
"uri": "/ip",
"upstream" : {
"type": "roundrobin",
"nodes": {
"httpbin.org:443": 1
},
"pass_host": "node",
"scheme": "https"
}
}'
I have try http://httpbin.org/ is working . https://httpbin.org is working too.
I cannot reproduce either. The HTTP port with httpbin.org should work. When you create the route, did it create successfully with a 201 response code?
Sometimes the etcd nodes take a couple seconds to be ready and if you happen to be creating routes during then, the route is not created.
I have try http://httpbin.org/ is working . https://httpbin.org is working too.
Yes direct connections to http://httpbin.org/ work but connections through APISIX with a route to httpbin.org:80 doesnt work http://127.0.0.1:9080/ip.
I cannot reproduce either. The HTTP port with httpbin.org should work. When you create the route, did it create successfully with a 201 response code?
Sometimes the etcd nodes take a couple seconds to be ready and if you happen to be creating routes during then, the route is not created.
I just recreated the situation using the documentation
curl -sL https://run.api7.ai/apisix/quickstart | sh
curl -i "http://127.0.0.1:9180/apisix/admin/routes" -X PUT -d '
{
"id": "getting-started-ip",
"uri": "/ip",
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'
curl "http://127.0.0.1:9080/ip"
Cannot reproduce. Very strange case. Any more context?
From your screenshot, it seems that you have gotten a 404 not found HTML page when visiting the route:
Not sure how this happened and this doesn't look like it's from APISIX... Because if you request a route that does not exist, the message you get should look like this:
Maybe some oddity of WSL2
All happens within .000075 seconds
will try it again on a Mac to see if its WSL related
Ok I can confirm this is an oddity of running it on Windows WSL2. This works fine on a Mac. Perhaps the documentation should mention WSL2 having oddities?
Perhaps the documentation should mention WSL2 having oddities?
I think it should be more specific than "oddities" if this goes on doc and should be understood better. I don't have windows system and cannot investigate further. If you have any ideas, feel free to open a PR. Thanks.
Perhaps the documentation should mention WSL2 having oddities?
Need someone with WSL2 environment to check and determine the next actionable item for this issue.
Closing this issue now as the original reporter's issue has been resolved.
As for the WSL2 oddity (not consistently reported) it can be opened as a new issue if anyone runs into it in the future.
