I am trying to replace Azure Application Gateway (AGW) with Traefik and facing issues while at it. I have multiple K8S services served over port 80 and one of them is overridden using this ingress annotation for AGW - appgw.ingress.kubernetes.io/override-frontend-port: "8200"
.
I am trying to use IngressRoute approach on Traefik (installed using Helm) and there doesn't seem to be an equivalent for the annotation here. I don't mind if it is successfully served over port 80.
This is the manifest I am applying over vanilla Traefik setup that I have.
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: ssl-redirect
spec:
redirectScheme:
scheme: https
permanent: true
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirect-to-app1
namespace: <namespace>
spec:
redirectRegex:
regex: "^http://[^/]+/$"
replacement: "http://$${1}/app1"
permanent: true
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: app-ingress-route
namespace: <namespace>
spec:
entryPoints:
- websecure
- web
routes:
- match: PathPrefix(`/`)
kind: Rule
services:
- name: app1-service
namespace: <namespace>
port: 80
middlewares:
- name: ssl-redirect
- name: redirect-to-app1
- match: PathPrefix(`/app2`)
kind: Rule
services:
- name: app2-service
namespace: <namespace>
port: 80
middlewares:
- name: ssl-redirect
tls:
secretName: sslcert
Coming to the current situation,
<url>/app1
works,<url>/
redirects to the former as expected. HTTPS is also taken care of<url>/app2
fails to load resources. With the app gateway in place, it loaded fine from<url>:8200/app2
but does not happen in the current form. The request URLs as seen in the developer tools don't haveapp2
in them and the status code shows 404. Changing the application code is not an option for us.
How to handle this situation?