<p>I'm trying to test and implement Traefik's <em>https</em> redirect feature in my kubernetes cluster per Traefik's documentation: <a href="https://docs.traefik.io/middlewares/overview/" rel="nofollow noreferrer">https://docs.traefik.io/middlewares/overview/</a>. Here's the definition of the <code>Middleware</code> and <code>IngressRoute</code>:</p>

<pre><code>apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: ingressroutetls
  namespace: default
spec:
  entryPoints:
    - web
    - websecure
  routes:
  - match: Host(`your.domain.name`) &amp;&amp; Host(`www.your.domain.name`)
    kind: Rule
    services:
    - name: traefik-dashboard
      port: 8080
    middlewares:
      - name: redirectscheme
  tls:
    secretName: cloud-tls
</code></pre>

<pre><code>apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: redirectscheme
spec:
  redirectScheme:
    scheme: https
</code></pre>

<p>However, <strong>https</strong>://your.domain.name works and <strong>http</strong>://your.domain.name gives me a <em>404 page not found</em>.
Does anyone know what have I misconfigured ?</p>

Deepak Garg
<blockquote>
  <p>that worked for me:</p>
</blockquote>

<pre><code>apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: a3-ing
  namespace: default
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`example.com`)
    kind: Rule
    services:
    - name: whoami
      port: 80
  tls:
    certResolver: default
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: a3-ing-red
  namespace: default
spec:
  entryPoints:
    - web
  routes:
    - match: Host(`example.com`)
      middlewares:
        - name: test-redirectscheme
      kind: Rule
      services:
        - name: whoami
          port: 80
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: a3-ing-www
  namespace: default
spec:
  entryPoints:
    - websecure
  routes:
    - match: Host(`www.example.com`)
      kind: Rule
      services:
        - name: whoami
          port: 80
  tls:
    certResolver: default
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: a3-ing-www-red
  namespace: default
spec:
  entryPoints:
    - web
  routes:
    - match: Host(`www.example.com`)
      kind: Rule
      middlewares:
        - name: test-redirectscheme
      services:
        - name: whoami
          port: 80
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-redirectscheme
  namespace: default  
spec:
  redirectScheme:
    scheme: https
</code></pre>
