Connection refused while connecting to Upstream

I have a problem while connecting to the upstream.
I’m using docker kong. When I try to curl inside the docker container, everything is okay

Curl

curl --url host.docker.internal:8081

Response

{“String”:“Hello world!”}

But when accessing the service, the problem appear.

This is my kong.yml.

services:                                                                                                                                                               
- name: auth                                                                                                                                                           
   url: http://host.docker.internal:8081/                                                                                                                                               
  routes:  
  - name: my-route                                                                                                                                                          
    paths:                                                                                                                                                                  
     - /                                                                                                                                                                   
plugins:                                                                                                                                                              
  - name: key-auth                                                                                                                                                  
- name: my-services                                                                                                                                                      
  url: https://example.org                                                                                                                                                                                                                                                                                                                      

This is the full error messge

[error] 30#0: *7387 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: kong, request: "POST /auth HTTP/1.1", upstream: "http://172.18.0.1:8081/auth", host: "127.0.0.1:8000"

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ