0

"Cannot GET / " Issue in using express gateway with nodejs express API or "Bad gateway" when not give localhost as host in apiEndpoints

http:
  port: 9443
admin: 
  port: 9876
  host: localhost
apiEndpoints:
  api:
    paths: '/api/filepath/FilePath'
serviceEndpoints:
  httpbin:
    url: 'https://webapps.klikpal.com:8091'
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

1 Answers1

2

Some fixes in my experience:

  • Make sure the apiEndpoint path is an real route in your api code. This was my fix with the cannot get error.
  • For the bad gateway error I had to make sure the database had to be connected and running.

Yesterday I encountered somewhat the same error, and I created a question, maybe it helps: How do i use multiple paths and endpoints in Express Gateway with my RESTAPI?