Hi,
I have configured Traefik to redirect everything from the HTTP port to the HTTPS port and also changed the scheme from HTTP to HTTPS with the following command line arguments:
--entrypoints.intern-secure.address=:8443/tcp
--entrypoints.intern-secure.http.tls=true
--entrypoints.intern-web.address=:8000/tcp
--entrypoints.intern-web.http.redirections.entryPoint.scheme=https
--entrypoints.intern-web.http.redirections.entryPoint.to=:443
--entrypoints.traefik.address=:9000/tcp
--providers.kubernetescrd
--providers.kubernetesingress
This works: every HTTP request is automatically "upgraded" to HTTPS. But the existing connection is upgraded and and the client is not forced to create a new connection.
Traefik is deployed in Kubernetes behind a LoadBalancer.
Current behavior:
When an HTTPS request arrives at the LoadBalancer than TLS termination is done and a new TLS connection is created to Traefik. Therefore, the client see the certificate of the LoadBalancer and not Traefik's self-signed certificate.
When an HTTP requests arrives at the LoadBalancer than the request is forwarded to Traefik. Traefik "upgrades" the connection and switches to HTTPS and uses it's self-signed certificate.
=> the client sees Traefik's certificate
Intended behavior:
When an HTTP requests arrives at the LoadBalancer than the request is forwarded to Traefik. Traefik informs the client to use a different port (443) an scheme (HTTPS) and closes the connection. The client creates a new connection with the new port and scheme (HTTPS). The client never sees Traefik's self-signed certificate.
Is such a configuration possible with Traefik? Would using the RedirectScheme middleware solve the problem or does it work the same way as the command line arguments?
Regards
Bernhard