ExpressGateway / express-gateway

A microservices API Gateway built on top of Express.js
https://www.express-gateway.io
Apache License 2.0
2.97k stars 344 forks source link

Bad gateway #973

Closed kKen94 closed 4 years ago

kKen94 commented 4 years ago

I create Express Gateway with option "Getting Started with Express Gateway", and this is gateway.config.yml

http:
  port: 8080
admin:
  port: 9876
  host: localhost
apiEndpoints:
  api:
    host: localhost
    paths: '/ip'
serviceEndpoints:
  httpbin:
    url: 'https://httpbin.org'
policies:
  - basic-auth
  - cors
  - expression
  - key-auth
  - log
  - oauth2
  - proxy
  - rate-limit
pipelines:
  default:
    apiEndpoints:
      - api
    policies:
    # Uncomment `key-auth:` when instructed to in the Getting Started guide.
    # - key-auth:
      - proxy:
          - action:
              serviceEndpoint: httpbin 
              changeOrigin: true

I simply change url: 'https://httpbin.org' to url: 'http://localhost:3001' and i have or Bad Gateway or other error.

If I call localhost:3001 directly i have the response of my service

MohammadWasi commented 4 years ago

@kKen94 Express gateway server listens on port 8080. Express gateway sits in front of http://localhost:3001, To use the service of the gateway you have to call 'http://localhost:8080' instead of 'http://localhost:3001'.

XVincentX commented 4 years ago

Thanks for the quick response @MohammadWasi

kKen94 commented 4 years ago

Yes, I missed to write that I have bad gateway if I call localhost:8080/ip with httpbin: url: 'http://localhost:3001'