Traefik 502错误的网关|配置错误? |固定nextjs

时间:2019-06-20 11:13:39

标签: fastify

我有一个auth服务(node.js后端,fastify),nextjs服务,它在前面服务于SSR react app和traefik作为反向代理。 使用当前配置,该应用可以正确运行,但是我得到502 Bad Gateway的{​​{1}}。

auth
// traefik.toml

[entryPoints]
    [entryPoints.http]
       address = ":80"
[api]

// traefik docker-compose
version: '3'

networks:
  default:
    external:
      name: traefik_default

services:
  reverse-proxy:
    image: traefik
    command: --docker
    ports:
      - "80:80"
      - "8080:8080" # The Web UI (enabled by --api)
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/traefik.toml
// auth docker-compose

version: "3.7"

networks:
  default:
    external:
      name: traefik_default

services:
  auth:
    build: .
    labels:
     - "traefik.frontends=auth"
     - "traefik.frontend.rule=Host:auth.app.loc"
     - "treafik.port=80"
     - "traefik.backends=backend_auth"
    volumes:
      - .:/usr/src/app
      - /usr/src/app/node_modules
    ports:
      - 5000
    command: node .

1 个答案:

答案 0 :(得分:0)

问题是// nextjs app docker-compose version: "3.7" networks: default: external: name: traefik_default services: nextjs: build: . labels: - "traefik.frontends=nextjs" - "traefik.frontend.rule=Host:app.loc" - "treafik.port=80" - "traefik.backends=backend_nextjs" volumes: - .:/usr/src/app - /usr/src/app/node_modules ports: - 3000 command: npm run dev fastify接口上监听,并且需要更改为127.0.0.1在所有接口上监听

0.0.0.0