I'm trying to make a dynamic route file that has a main service on a subdomain and have requests to /api redirect to a dedicated api container. I added pathPrefix rules and set priorities but all requests including the /api requests go to the main container.
Can anyone help me see what I'm doing wrong? I've been troubleshooting this for over a week
http:
services:
app:
loadBalancer:
servers:
- url: "http://{service-ip}:{main-service-port}"
app-api:
loadBalancer:
servers:
- url: "http://{service-ip}:{api-service-port}"
middlewares:
redirect-to-https:
redirectScheme:
scheme: "https"
gzip:
app: true
routers:
http-app:
entryPoints:
- http
middlewares:
- redirect-to-https
rule: "Host(`{host-domain}`)"
service: "app"
priority: 10
https-app:
entryPoints:
- https
middlewares:
- gzip
rule: "Host(`{host-domain}`)"
service: "app"
priority: 20
tls:
certResolver: "letsencrypt"
app-api:
entryPoints:
- http
- https
rule: "Host(`{host-domain}`) && PathPrefix(`/api/`)"
service: "app-api"
priority: 30