Redirect to https results in 404

Hello
Maybe someone can help me. I try to redirect all requests from http to https

hier is my config:

## Dynamic configuration
http:  
  routers:    
    backup:      
      entryPoints:        
        - "web"
        - "websecure"      
       tls: {}      
       rule: "Host(`backup.mydomain.com`)"
       middlewares:        
         - "backup-ssl-redirect"      
       service: "backup"  
  services:    
    backup:      
      loadBalancer:        
        servers:          
          - url: "http://localhost:8082"  
  middlewares:    
    backup-ssl-redirect:      
      redirectScheme:        
        scheme: "https"        
        permanent: true

browsing the URL results in a 404 Not Found

Hello,

there is an example that use redirect here:

It's docker but can be translated to a file.

Yours does not look like it's going to work because it creates a tls router but does not create a non-tls one, thus it cannot match on a plain http request. When that's fixed, there could be further impediments depending on the fix.

1 Like

hmm I followed the docs here:

https://docs.traefik.io/routing/routers/#entrypoints

This states, that I need one router, accepting the two entrypoints for http/https?

You need two routers. While one router can accept requests from multiple entry points, as the doco says, it cannot accept both http and https at the same time.

fixed. the marked answer was the solution :wink:
Thanks