HTTP to HTTPS Redirect has no effect

I have created a Middleware and IngressRoute like in the docs example.

Everything appears to be fine traffic on 443 is working and traefik show in the dashboard that there is a middleware. There aren't any error logs visible.

however everytime I call curl http://domain.com a 404 is returned.
Also reading the other question here in the forum didn't help.

Redirect Loop with HTTPS redirectScheme suggests to create two routes. Why should be mandatory to have two IngressRoutes? A route itself would no make sense a tls and entryPoints are a level above routes.

          - apiVersion: traefik.containo.us/v1alpha1
            kind: Middleware
            metadata:
              name: redirect-http-to-https
            spec:
              redirectScheme:
                scheme: https
                permanent: true
          # INGRESS GRAFANA
          - apiVersion: traefik.containo.us/v1alpha1
            kind: IngressRoute
            metadata:
              name: prometheus-operator-grafana
            spec:
              entryPoints:
                - websecure
                - web
              routes:
                - match: Host(`{{ .Values.grafana_domain }}`)
                  kind: Rule
                  services:
                    - name: prometheus-operator-grafana
                      port: 80
                  middlewares:
                    - name: redirect-http-to-https
              tls:
                secretName: monitoring-grafana-prod-tls
                domains:
                  - main: {{ .Values.grafana_domain }}

I was able to figure that out. Would have been nice if the docs mentioned that if TLS is enabled that non TLS traffic will be ignored. Hence the solution with two IngressRoutes one for HTTP and another for HTTPS

Here is the working solution for redirecting traffic from HTTP to HTTPS

          # REDIRECT TO HTTPS MIDDLEWARE
          - apiVersion: traefik.containo.us/v1alpha1
            kind: Middleware
            metadata:
              name: redirect-http-to-https
            spec:
              redirectScheme:
                scheme: https
                permanent: true

          # INGRESS GRAFANA HTTPS
          - apiVersion: traefik.containo.us/v1alpha1
            kind: IngressRoute
            metadata:
              name: prometheus-operator-grafana
            spec:
              entryPoints:
                - websecure
              routes:
                - match: Host(`{{ .Values.grafana_domain }}`)
                  kind: Rule
                  services:
                    - name: prometheus-operator-grafana
                      port: 80
              tls:
                secretName: monitoring-grafana-prod-tls
                domains:
                  - main: {{ .Values.grafana_domain }}

          # INGRESS GRAFANA HTTP to HTTPS Redirect
          - apiVersion: traefik.containo.us/v1alpha1
            kind: IngressRoute
            metadata:
              name: prometheus-operator-grafana-redirect-https
            spec:
              entryPoints:
                - web
              routes:
                - match: Host(`{{ .Values.grafana_domain }}`)
                  kind: Rule
                  services:
                    - name: prometheus-operator-grafana
                      port: 80
                  middlewares:
                    - name: redirect-http-to-https

Hi, I got the same issue with you,

maybe can't reference two entrypoints in an ingressRoute,

entryPoints:
                - websecure
                - web

websecure is in front of web,

websecure endpoint redirects, but no chaning on web endpoint

mine: web in front websecure


web endpoint can redirect, but i can't open https page

if tls enabled, not redirect