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: set upstream scheme to https #11265

Closed
wants to merge 1 commit into from
Closed

Conversation

xputerax
Copy link

@xputerax xputerax commented May 18, 2024

Description

The command given to create a route in the Getting Started section of the docs did not work. It caused a 504 error.

$ 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
    }
  }
}'
HTTP/1.1 201 Created
Date: Sat, 18 May 2024 15:54:24 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX/3.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: *
Access-Control-Max-Age: 3600
X-API-VERSION: v3

{"value":{"priority":0,"uri":"/ip","status":1,"upstream":{"pass_host":"pass","type":"roundrobin","hash_on":"vars","nodes":{"httpbin.org:80":1},"scheme":"http"},"create_time":1716047664,"id":"getting-started-ip","update_time":1716047664},"key":"/apisix/routes/getting-started-ip"}

$ curl "http://127.0.0.1:9080/ip"

<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>openresty</center>
<p><em>Powered by <a href="https://apisix.apache.org/">APISIX</a>.</em></p></body>
</html>

However, it will work after setting scheme to https and changing port 80 to 443

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
    },
    "scheme": "https"
  }
}'
HTTP/1.1 201 Created
Date: Sat, 18 May 2024 16:18:56 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX/3.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: *
Access-Control-Max-Age: 3600
X-API-VERSION: v3

{"value":{"priority":0,"uri":"/ip","status":1,"upstream":{"pass_host":"pass","type":"roundrobin","hash_on":"vars","scheme":"https","nodes":{"httpbin.org:443":1}},"create_time":1716049136,"id":"getting-started-ip","update_time":1716049136},"key":"/apisix/routes/getting-started-ip"}


$ curl localhost:9080/ip
{
  "origin": "192.168.247.1, 115.xxx.yyy.zz"
}

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@hanqingwu
Copy link
Contributor

httpbin.org:80 it works , please check your env .
image

@xputerax xputerax closed this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants