# HTTP to HTTPS Redirect has no effect

**URL:** <https://community.traefik.io/t/http-to-https-redirect-has-no-effect/5382>\
**Category:** Traefik v2\
**Tags:** middleware, kubernetes-crd\
**Created:** [April 8, 2020, 9:14pm UTC](https://community.traefik.io/t/http-to-https-redirect-has-no-effect/5382 "2020-04-08T21:14:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vad1mo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/vad1mo/32/1878_2.png) [@Vad1mo](https://community.traefik.io/u/Vad1mo)\
**Post date:** [April 8, 2020, 9:14pm UTC](https://community.traefik.io/t/http-to-https-redirect-has-no-effect/5382/1 "2020-04-08T21:14:53Z")

</div>

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](https://community.containo.us/t/redirect-loop-with-https-redirectscheme/2679/4) 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.

```auto
          - 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 }}

```

 ![Bildschirmfoto 2020-04-08 um 23.06.40](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/b432f1a81b33ff4b54903e6e4b247392d4b1503f.png)

---

<div class="post-metadata">

**Author:** ![Vad1mo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/vad1mo/32/1878_2.png) [@Vad1mo](https://community.traefik.io/u/Vad1mo)\
**Post date:** [April 9, 2020, 7:17am UTC](https://community.traefik.io/t/http-to-https-redirect-has-no-effect/5382/2 "2020-04-09T07:17:35Z")

</div>

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

```yaml
          # 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

```

---

<div class="post-metadata">

**Author:** ![df1228](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/df1228/32/339_2.png) [@df1228](https://community.traefik.io/u/df1228)\
**Post date:** [November 1, 2020, 2:50am UTC](https://community.traefik.io/t/http-to-https-redirect-has-no-effect/5382/3 "2020-11-01T02:50:45Z")

</div>

Hi, I got the same issue with you,

maybe can't reference two entrypoints in an ingressRoute,

```auto
entryPoints:
                - websecure
                - web

```

websecure is in front of web,  
[![](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/b432f1a81b33ff4b54903e6e4b247392d4b1503f.png) ](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/b432f1a81b33ff4b54903e6e4b247392d4b1503f.png)

websecure endpoint redirects, but no chaning on web endpoint

mine: web in front websecure

 ![image](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bbe9916b86a4172451787c95dec7cd655c52ad33.png)  
web endpoint can redirect, but i can't open https page

if tls enabled, not redirect
