Redirect in Traefik from one domain to another Redirect in Traefik from one domain to another kubernetes kubernetes

Redirect in Traefik from one domain to another


I was having the same issue and ended up making it work with:

---apiVersion: extensions/v1beta1kind: Ingressmetadata:  name: www-redirect  namespace: public  annotations:    kubernetes.io/ingress.class: traefik    traefik.ingress.kubernetes.io/preserve-host: "true"    traefik.ingress.kubernetes.io/redirect-permanent: "true"    traefik.ingress.kubernetes.io/redirect-regex: "^https://www.(.*)"    traefik.ingress.kubernetes.io/redirect-replacement: "https://$1"spec:  tls:    - hosts:        - "example.com"        - "www.example.com"      secretName: example-tls  rules:  - host: example.com  - host: www.example.com

Basically I needed both rules.

As a side note, I also start the trafik pod with the following flags:

args:   - --api   - --kubernetes   - --logLevel=INFO   - --entryPoints=Name:https Address::443 TLS   - --entrypoints=Name:http Address::80 Redirect.EntryPoint:https   - --defaultentrypoints=https,http