You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "hachi029 (via GitHub)" <gi...@apache.org> on 2025/11/27 04:39:04 UTC

[PR] docs(getting-started): fix '502 Bad Gateway' error in the getting sta… [apisix]

hachi029 opened a new pull request, #12780:
URL: https://github.com/apache/apisix/pull/12780

   …rted tutorial
   
   ### Description
   
   When following the getting-started guide, a 502 Bad Gateway response is returned.
   
   `
   curl "http://127.0.0.1:9080/ip 
   
   <html>
   <head><title>502 Bad Gateway</title></head>
   <body>
   <center><h1>502 Bad Gateway</h1></center>
   <hr><center>openresty</center>
   <p><em>Powered by <a href="https://apisix.apache.org/">APISIX</a>.</em></p></body>
   </html>`
   
   Based on my validation, I found that the `pass_host: "node"` configuration must be added to the route to make APISIX send right `Host` to get a correct response (instead of 502 errors).
   
   'curl -m 5 -v "http://httpbin.org/ip"
   * Connected to httpbin.org (100.29.246.92) port 80
   > GET /ip HTTP/1.1
   > Host: httpbin.org
   > User-Agent: curl/8.5.0
   > Accept: */*
   >
   < HTTP/1.1 200 OK
   < Connection: close
   < Content-Length: 34
   < Access-Control-Allow-Credentials: true
   < Access-Control-Allow-Origin: *
   < Content-Type: application/json
   < Date: Thu, 27 Nov 2025 04:33:11 GMT
   < Server: gunicorn/19.9.0
   <
   {
     "origin": "101.x.x.177"
   }
   
   
   root@28d6b762434f:/workspace# curl -m 5 -v "http://httpbin.org/ip" -H "Host: 127.0.0.1:9080"
   * Connected to httpbin.org (3.219.87.227) port 80
   > GET /ip HTTP/1.1
   > Host: 127.0.0.1:9080
   > User-Agent: curl/8.5.0
   > Accept: */*
   >
   * Operation timed out after 5002 milliseconds with 0 bytes received
   * Closing connection
   curl: (28) Operation timed out after 5002 milliseconds with 0 bytes received'
   
   
   #### Which issue(s) this PR fixes:
   
   
   ### 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](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(getting-started): fix '502 Bad Gateway' error in the getting sta… [apisix]

Posted by "hachi029 (via GitHub)" <gi...@apache.org>.
hachi029 commented on PR #12780:
URL: https://github.com/apache/apisix/pull/12780#issuecomment-3584563607

   It's ok on my volcengine ECS, but not on my personal computer.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(getting-started): fix '502 Bad Gateway' error in the getting sta… [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on PR #12780:
URL: https://github.com/apache/apisix/pull/12780#issuecomment-3584357069

   Hi @hachi029, I didn't have the problem you described after trying it locally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(getting-started): fix '502 Bad Gateway' error in the getting sta… [apisix]

Posted by "hachi029 (via GitHub)" <gi...@apache.org>.
hachi029 closed pull request #12780: docs(getting-started): fix '502 Bad Gateway' error in the getting sta…
URL: https://github.com/apache/apisix/pull/12780


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(getting-started): fix '502 Bad Gateway' error in the getting sta… [apisix]

Posted by "hachi029 (via GitHub)" <gi...@apache.org>.
hachi029 commented on PR #12780:
URL: https://github.com/apache/apisix/pull/12780#issuecomment-3584503293

   I’ve also verified this on other computers and encountered the same issue:
   
   1.  OK:
   
   ~ curl -v httpbin.org/ip                          
   \* Host httpbin.org:80 was resolved.
   \* IPv6: (none)
   \* IPv4: 52.6.181.49, 54.227.38.221, 3.219.87.227, 3.232.74.21, 52.44.182.178, 100.29.246.92
   \*   Trying 52.6.181.49:80...
   \* Connected to httpbin.org (52.6.181.49) port 80
   \> GET /ip HTTP/1.1
   \> Host: httpbin.org
   \> User-Agent: curl/8.7.1
   \> Accept: \*/\*
   > 
   \* Request completely sent off
   < HTTP/1.1 200 OK
   < Date: Thu, 27 Nov 2025 07:17:22 GMT
   < Content-Type: application/json
   < Content-Length: 33
   < Connection: keep-alive
   < Server: gunicorn/19.9.0
   < Access-Control-Allow-Origin: \*
   < Access-Control-Allow-Credentials: true
   < 
   {
     "origin": "223.x.x.x"
   }
   \* Connection #0 to host httpbin.org left intact
   
   2. failed with Header `Host: 127.0.0.1:8090` just like APISIX does in the getting stated tutorial.
   
   ➜  ~ curl -v httpbin.org/ip -H "Host: 127.0.0.1:8090"
   \* Host httpbin.org:80 was resolved.
   \* IPv6: (none)
   \* IPv4: 54.227.38.221, 3.219.87.227, 3.232.74.21, 52.44.182.178, 100.29.246.92, 52.6.181.49
   \*   Trying 54.227.38.221:80...
   \* Connected to httpbin.org (54.227.38.221) port 80
   \> GET /ip HTTP/1.1
   \> Host: 127.0.0.1:8090
   \> User-Agent: curl/8.7.1
   \> Accept: \*/\*
   > 
   \* Request completely sent off
   \* Recv failure: Connection reset by peer
   \* Closing connection
   curl: (56) Recv failure: Connection reset by peer
   
   
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org