I have an IngressRoute setup:
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: landing-test-secure
namespace: test
spec:
entryPoints:
- websecure
routes:
# Match is the rule corresponding to an underlying router.
- match: Host(`site.test`, `www.site.test`)
kind: Rule
services:
- name: landing-published
port: 3000
middlewares:
- name: traefik-http@kubernetescrd
- name: traefik-addwww@kubernetescrd
---
With the following middleware:
---
# Redirect to http
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: http
spec:
redirectScheme:
scheme: http
port: 80
---
# Add www
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: addwww
spec:
redirectRegex:
regex: http(s?)://([^w]{3})(.*)
replacement: http://www.${2}${3}
---
If I go to https://www.site.test I do not get redirected to http://www.site.test
However, if I go to https://site.test I do get redirected to http://www.site.test
It seems that the RedirectRegex middleware works, but RedirectScheme does not.
In the dashboard, I see that both middlewares are active on the route. On most other routes I have the exact same setup but in reverse (http -> https) and it works fine. For some reason when going the other way, it does not seem to work.