All requests to the portal.domain.com/api/v1
keep getting redirected despite setting PathPrefix(
/api/v1)
on the backend route rule. and the request endup being handled by the frontend container running nginx.
backend:
build:
context: ./context
dockerfile: Dockerfile
networks:
- srv_traefik-network # Use the same shared network
- backend-network
depends_on:
- database
labels:
- "traefik.enable=true" # Enable Traefik for this service
- "traefik.http.routers.backend.rule=Host(www.portal.domain.com`) && PathPrefix(`/api/v1`)" # Route for main domain and path`
- "traefik.http.routers.backend.priority=1" # Higher priority
- "traefik.http.routers.backend.entrypoints=websecure" # Use HTTPS entry point
- "traefik.http.routers.backend.tls.certresolver=myresolver" # Use Let's Encrypt for HTTPS
- "traefik.http.services.backend.loadbalancer.server.port=4000" # The internal port to route traffic to
frontend:
build:
context: ./context
dockerfile: Dockerfile
networks:
- srv_traefik-network # Use the same shared network
depends_on:
- backend
labels:
- "traefik.enable=true" # Enable Traefik for this service
- "traefik.http.routers.frontend.rule=Host(www.portal.domain.com`)"# Route for main domain and path`
- "traefik.http.routers.frontend.entrypoints=websecure" # Use HTTPS entry point
- "traefik.http.routers.frontend.tls.certresolver=myresolver" # Use Let's Encrypt for HTTPS
- "traefik.http.services.frontend.loadbalancer.server.port=80" # The internal port to route traffic to
i tried to put the backend service above to see if it was
precedence also set the - "traefik.http.routers.backend.priority=1"
to check if its a priority issue.