Hello, can somebody explain if it's possible
I have two apps: web and api
- web is
app.example.com
- api is
app.example.com/api/v1
Now I wanna make it like:
- web is
app.example.com
- api is
app.example.com/api/v1 && api.example.com/v1
I followed instructions but new subdomain for api doesn't work (i see specific traefik 404 not found page). Here is a part of my docker-compose.yml:
services:
api:
image: api:latest
labels:
- traefik.enable=true
- traefik.http.routers.api.entrypoints=websecure
- traefik.http.routers.api.rule=(Host(`api.example.com`) && PathPrefix(`/v1`)) || (Host(`app.example.com`) && PathPrefix(`/api/v1`))
- traefik.http.routers.api.tls.certresolver=le
- traefik.http.routers.api.middlewares=api-strip-prefix
- traefik.http.middlewares.api-strip-prefix.stripprefix.prefixes=/api/v1,/v1
env_file:
- .env
depends_on:
- postgres
networks:
- app
web:
image: web:latest
labels:
- traefik.enable=true
- traefik.http.routers.web.rule=Host(`app.example.com`)
- traefik.http.routers.web.entrypoints=websecure
- traefik.http.routers.web.tls.certresolver=le
depends_on:
- api
networks:
- app
With this api still works only on app.example.com/api/v1