我有一个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 .
答案 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