Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: getting-started-ip example doesn't work the api consumer request returns 404 #11205

Open
phpdave opened this issue Apr 26, 2024 · 10 comments
Labels
doc Documentation things good first issue Good for newcomers

Comments

@phpdave
Copy link

phpdave commented Apr 26, 2024

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"
  }
}'
@phpdave phpdave added the doc Documentation things label Apr 26, 2024
@hanqingwu
Copy link
Contributor

I have try http://httpbin.org/ is working . https://httpbin.org is working too.
image

@kayx23
Copy link
Member

kayx23 commented Apr 28, 2024

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.

@phpdave
Copy link
Author

phpdave commented Apr 28, 2024

I have try http://httpbin.org/ is working . https://httpbin.org is working too.
image

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"

image

@kayx23
Copy link
Member

kayx23 commented Apr 29, 2024

image

Cannot reproduce. Very strange case. Any more context?

@kayx23
Copy link
Member

kayx23 commented Apr 29, 2024

From your screenshot, it seems that you have gotten a 404 not found HTML page when visiting the route:

image

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:

image

@phpdave
Copy link
Author

phpdave commented Apr 29, 2024

Maybe some oddity of WSL2

All happens within .000075 seconds

image

@phpdave
Copy link
Author

phpdave commented Apr 29, 2024

will try it again on a Mac to see if its WSL related

@shreemaan-abhishek shreemaan-abhishek added the wait for update wait for the author's response in this issue/PR label Apr 29, 2024
@phpdave
Copy link
Author

phpdave commented Apr 29, 2024

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?

@github-actions github-actions bot added user responded and removed wait for update wait for the author's response in this issue/PR labels Apr 29, 2024
@kayx23
Copy link
Member

kayx23 commented Apr 30, 2024

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.

@kayx23 kayx23 added good first issue Good for newcomers and removed user responded labels May 10, 2024
@kayx23
Copy link
Member

kayx23 commented May 11, 2024

Perhaps the documentation should mention WSL2 having oddities?

Need someone with WSL2 environment to check and determine the next actionable item for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation things good first issue Good for newcomers
Projects
Status: 📋 Backlog
Development

No branches or pull requests

4 participants