-1

I want run my express-gateway locally in my pc and have two services for access with my gateway, the problem is that always have the same problem "bad gateway" I test with other public api and work fine, how can do run this locally without this problem? because always show "bad gateway":

my docker-compose.yml

version: "3.4"
services:
  express-gateway:
    image: gateway:latest
    build:
      context: ./
      dockerfile: Dockerfile
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.express-gateway.rule=Host(`eg.127.0.0.1.nip.io`)"
      - "traefik.http.routers.express-gateway.entrypoints=web"
      - "traefik.http.services.express-gateway.loadbalancer.server.port=9090"
    volumes:
      - ./gateway.config.yml:/usr/src/app/config/gateway.config.yml

  ingress-controller:
    image: traefik:v2.0
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    ports:
      - 80:80
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

this is the configuration on my express gateway. my gateway.config.yml :

http:
  port: 9090
admin:
  port: 9876
  host: 0.0.0.0
apiEndpoints:
  events:
    host: "*"
    paths: ["/api/events*", "/swagger*"]
    methods: ["GET", "PATCH"]
  eventsCreate:
    host: "*"
    paths: "/api/events*"
    methods: ["POST", "PUT", "OPTIONS"]
  auth:
    host: "*"
    paths: "/api/auth*"
    methods: ["POST", "GET", "OPTIONS"]
serviceEndpoints:
  auth:
    url: "http://127.0.0.1:59868"
  events:
    url: "http://127.0.0.1:5000"
policies:
  - basic-auth
  - cors
  - expression
  - key-auth
  - log
  - oauth2
  - proxy
  - rate-limit
  - jwt
  - request-transformer
pipelines:
  authPipeline:
    apiEndpoints:
      - auth
    policies:
      - cors:
      - log:
          action:
            message: "auth ${req.method}"
      - proxy:
          action:
            serviceEndpoint: auth
            changeOrigin: true
  eventsPipeline:
    apiEndpoints:
      - events
    policies:
      - cors:
      - log:
          action:
            message: "events ${req.method}"
      - proxy:
          action:
            serviceEndpoint: events
            changeOrigin: true
  eventsCreatePipeline:
    apiEndpoints:
      - eventsCreate
    policies:
      - cors:
      - log:
          action:
            message: "events ${req.method}"
      - jwt:
          action:
            secretOrPublicKey: "MORTADELAIsMyPassion321"
            checkCredentialExistence: false
      - proxy:
          action:
            serviceEndpoint: events
            changeOrigin: true
CoolLife
  • 1,419
  • 4
  • 17
  • 43

1 Answers1

0

Bad Gateway is usually an error raised by the Proxy policy — in such case you should be able to check the log and see the specifics, and then go from there.

Vincenzo
  • 1,549
  • 1
  • 9
  • 17