You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/25 17:15:48 UTC

[GitHub] [apisix] pawarjayesh1985 opened a new issue #4667: bug: Getting 502 Bad Gateway issue

pawarjayesh1985 opened a new issue #4667:
URL: https://github.com/apache/apisix/issues/4667


   ### Issue description
   I have created simple route and upstream configuration. as follows:
   
   Created route:
   
   {
     "uri": "/order",
     "name": "",
     "host": "localhost",
     "upstream_id": "1",
     "status": 1
   }
   
   Created Upstream:
   {
     "nodes": [
       {
         "host": "localhost",
         "port": 9181,
         "weight": 1
       }
     ],
     "timeout": {
       "connect": 6,
       "read": 6,
       "send": 6
     },
     "type": "roundrobin",
     "scheme": "http",
     "pass_host": "pass",
     "name": "Upstream1"
   }
   
   Binding
   
   curl "http://127.0.0.1:9080/apisix/admin/routes/365245490364678847" -H "X-API-KEY: <KEY>" -X PUT -d '
   {
     "uri": "/order",
     "host": "localhost",
     "upstream_id": "1"
   }'
   
   
   But, when I tried this curl:
   
   I am getting following issue:
   
   $ curl -i -X GET "http://127.0.0.1:9080/order" -H "Host: localhost"
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
   100   154  100   154    0     0    154      0  0:00:01 --:--:--  0:00:01  150kHTTP/1.1 502 Bad Gateway
   Date: Sun, 25 Jul 2021 17:13:38 GMT
   Content-Type: text/html; charset=utf-8
   Content-Length: 154
   Connection: keep-alive
   Server: APISIX/2.6
   X-APISIX-Upstream-Status: 502
   
   <html>
   <head><title>502 Bad Gateway</title></head>
   <body>
   <center><h1>502 Bad Gateway</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   
   
   Could you please help me out to resolve this issue as soon as possible?
   
   ### Environment
   
   Bug report without environment information will be ignored or closed.
   
   * apisix version (cmd: `apisix version`):
   * OS (cmd: `uname -a`):
   * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   * apisix-dashboard version, if have:
   * luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   
   ### Minimal test code / Steps to reproduce the issue
   
   Bug report without steps to reproduce will be ignored or closed.
   
   1.
   2.
   3.
   
   ### What's the actual result? (including assertion message & call stack if applicable)
   $ curl -i -X GET "http://127.0.0.1:9080/order" -H "Host: localhost"
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
   100   154  100   154    0     0    154      0  0:00:01 --:--:--  0:00:01  150kHTTP/1.1 502 Bad Gateway
   Date: Sun, 25 Jul 2021 17:13:38 GMT
   Content-Type: text/html; charset=utf-8
   Content-Length: 154
   Connection: keep-alive
   Server: APISIX/2.6
   X-APISIX-Upstream-Status: 502
   
   <html>
   <head><title>502 Bad Gateway</title></head>
   <body>
   <center><h1>502 Bad Gateway</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   
   
   
   
   ### What's the expected result?
   
   http://localhost:9080/order
    should give me proper response from the upstream(microservice).


-- 
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



[GitHub] [apisix] tokers commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-886292771


   What's the result if you send requests to the upstream directly?


-- 
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



[GitHub] [apisix] tzssangglass commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-897680473


   so we can close this? @Garden12138 


-- 
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



[GitHub] [apisix] pawarjayesh1985 commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
pawarjayesh1985 commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-887234953


   2021/07/26 13:04:13 [warn] 47#47: *8 [lua] plugin.lua:173: load(): new plugins: {"ext-plugin-pre-req":true,"batch-requests":true,"proxy-cache":true,"fault-injection":true,"request-validation":true,"api-breaker":true,"limit-count":true,"ip-restriction":true,"udp-logger":true,"consumer-restriction":true,"limit-req":true,"serverless-pre-function":true,"uri-blocker":true,"authz-keycloak":true,"grpc-transcode":true,"openid-connect":true,"response-rewrite":true,"proxy-mirror":true,"kafka-logger":true,"traffic-split":true,"tcp-logger":true,"zipkin":true,"wolf-rbac":true,"referer-restriction":true,"proxy-rewrite":true,"server-info":true,"serverless-post-function":true,"basic-auth":true,"hmac-auth":true,"prometheus":true,"syslog":true,"sls-logger":true,"key-auth":true,"request-id":true,"cors":true,"ext-plugin-post-req":true,"jwt-auth":true,"redirect":true,"echo":true,"http-logger":true,"limit-conn":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 48#48: *6 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 47#47: *8 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 49#49: *7 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 53#53: *1 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 44#44: *3 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 46#46: *9 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 45#45: *4 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 50#50: *5 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 43#43: *2 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:14 [warn] 43#43: *14 [lua] init.lua:290: sync_local_conf_to_etcd(): sync local conf to etcd, context: ngx.timer
   2021/07/26 13:05:30 [error] 45#45: *9097 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://127.0.0.1:9181/order", host: "localhost"
   2021/07/26 13:05:30 [error] 45#45: *9097 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", subrequest: "/proxy_mirror", upstream: "http://127.0.0.1:9181/order", host: "localhost"
   2021/07/26 14:05:23 [error] 47#47: *430492 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", subrequest: "/proxy_mirror", upstream: "http://127.0.0.1:9181/order", host: "localhost"
   2021/07/26 14:05:26 [error] 47#47: *430492 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost"
   2021/07/26 14:10:41 [error] 48#48: *467472 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost"
   2021/07/26 14:11:12 [error] 48#48: *469887 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost:9080"
   2021/07/26 14:11:25 [error] 48#48: *469887 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost:9080"
   2021/07/26 14:11:33 [error] 45#45: *473615 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost:9080"
   2021/07/27 06:01:45 [error] 44#44: *1734435 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost"


-- 
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



[GitHub] [apisix] pawarjayesh1985 commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
pawarjayesh1985 commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-886679670


   @tokers  :  below are the details.
   
   $ curl -i -X GET "http://localhost:9181/order"
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
   100    16  100    16    0     0     16      0  0:00:01 --:--:--  0:00:01   516HTTP/1.1 200
   Content-Type: text/plain;charset=UTF-8
   Content-Length: 16
   Date: Mon, 26 Jul 2021 12:55:12 GMT
   
   Hello javaTpoint
   
   
   Also, is it possible for you to contact me on slack "jayeshpawarin-cde1799.slack.com" 
   Please note, I wanted to complete the POC EOD this week.
   Thus, I wanted support as soon as possible.
   Also, is it possible for you to give your slack id?
   


-- 
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



[GitHub] [apisix] Garden12138 commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
Garden12138 commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-897704012


   > so we can close this? @Garden12138
   
   sure,of course.  


-- 
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



[GitHub] [apisix] tzssangglass closed issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
tzssangglass closed issue #4667:
URL: https://github.com/apache/apisix/issues/4667


   


-- 
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



[GitHub] [apisix] Garden12138 commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
Garden12138 commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-897598816


   I guess the service proxied by the upstream service runs on the host, apisix runs in the container and uses bridge mode. The configuration of localhost for the apisix upstream service will cause the bridge (172.18.0.1) to connect to 127.0.0.1 timeout. The solution is to set'localhost' Change to'host.docker.internal'... 
   <img width="927" alt="图片" src="https://user-images.githubusercontent.com/23191862/129196668-1b74a3f7-b935-4ce8-a331-56c5ddf37ec8.png">
   <img width="393" alt="图片" src="https://user-images.githubusercontent.com/23191862/129196739-d6a2b128-cbae-4149-8261-bb8a1b91a144.png">
   <img width="1279" alt="图片" src="https://user-images.githubusercontent.com/23191862/129196750-dfcd99b7-e0fb-4302-b925-16953d658f7f.png">
   


-- 
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



[GitHub] [apisix] pawarjayesh1985 edited a comment on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
pawarjayesh1985 edited a comment on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-887234953


   @tokers : Below are the logs
   
   2021/07/26 13:04:13 [warn] 47#47: *8 [lua] plugin.lua:173: load(): new plugins: {"ext-plugin-pre-req":true,"batch-requests":true,"proxy-cache":true,"fault-injection":true,"request-validation":true,"api-breaker":true,"limit-count":true,"ip-restriction":true,"udp-logger":true,"consumer-restriction":true,"limit-req":true,"serverless-pre-function":true,"uri-blocker":true,"authz-keycloak":true,"grpc-transcode":true,"openid-connect":true,"response-rewrite":true,"proxy-mirror":true,"kafka-logger":true,"traffic-split":true,"tcp-logger":true,"zipkin":true,"wolf-rbac":true,"referer-restriction":true,"proxy-rewrite":true,"server-info":true,"serverless-post-function":true,"basic-auth":true,"hmac-auth":true,"prometheus":true,"syslog":true,"sls-logger":true,"key-auth":true,"request-id":true,"cors":true,"ext-plugin-post-req":true,"jwt-auth":true,"redirect":true,"echo":true,"http-logger":true,"limit-conn":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 48#48: *6 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 47#47: *8 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 49#49: *7 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 53#53: *1 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 44#44: *3 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 46#46: *9 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 45#45: *4 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 50#50: *5 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:13 [warn] 43#43: *2 [lua] plugin.lua:221: load_stream(): new plugins: {"mqtt-proxy":true}, context: init_worker_by_lua*
   2021/07/26 13:04:14 [warn] 43#43: *14 [lua] init.lua:290: sync_local_conf_to_etcd(): sync local conf to etcd, context: ngx.timer
   2021/07/26 13:05:30 [error] 45#45: *9097 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://127.0.0.1:9181/order", host: "localhost"
   2021/07/26 13:05:30 [error] 45#45: *9097 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", subrequest: "/proxy_mirror", upstream: "http://127.0.0.1:9181/order", host: "localhost"
   2021/07/26 14:05:23 [error] 47#47: *430492 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", subrequest: "/proxy_mirror", upstream: "http://127.0.0.1:9181/order", host: "localhost"
   2021/07/26 14:05:26 [error] 47#47: *430492 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost"
   2021/07/26 14:10:41 [error] 48#48: *467472 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost"
   2021/07/26 14:11:12 [error] 48#48: *469887 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost:9080"
   2021/07/26 14:11:25 [error] 48#48: *469887 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost:9080"
   2021/07/26 14:11:33 [error] 45#45: *473615 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost:9080"
   2021/07/27 06:01:45 [error] 44#44: *1734435 connect() failed (113: Host is unreachable) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://172.18.176.1:9181/order", host: "localhost"


-- 
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



[GitHub] [apisix] tzssangglass commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-887332990


   > 2021/07/26 13:05:30 [error] 45#45: *9097 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: _, request: "GET /order HTTP/1.1", upstream: "http://127.0.0.1:9181/order", host: "localhost"
   
   This log is clear, no connection can be established with upstream, you should troubleshoot network connectivity issues within your environment.


-- 
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



[GitHub] [apisix] tokers commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-887142343


   Are there any error logs in the error.log file of Apache APISIX?


-- 
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



[GitHub] [apisix] tzssangglass commented on issue #4667: bug: Getting 502 Bad Gateway issue

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #4667:
URL: https://github.com/apache/apisix/issues/4667#issuecomment-897679922


   > The configuration of localhost for the apisix upstream service will cause the bridge (172.18.0.1) to connect to 127.0.0.1 timeout. The solution is to set'localhost' Change to'host.docker.internal'...
   
   yes, apisix is running inside the container, localhost will let apisix look inside in the container.


-- 
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