Issue with SSL Certificate and Redirection in Traefik Docker Compose Setup

Hello everyone,

I'm currently facing an issue with my Traefik Docker Compose setup where I'm trying to enable SSL certificates for my services along with HTTP-to-HTTPS redirection. However, I'm encountering a problem that I can't seem to resolve.

Here's a simplified version of my docker-compose.yml:

yaml

version: '3.9'

services:
reverse-proxy:
image: traefik:latest
ports:
- "80:80"
- "443:443"
command:
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedByDefault=false"
- "--providers.docker.network=traefik_web2"
- "--entryPoints.http.address=:80"
- "--entryPoints.websecure.address=:443"
- "--entrypoints.https.http.tls.certResolver=le"
# Other configurations...

volumes:
  - "/var/run/docker.sock:/var/run/docker.sock"

networks:
  - web

networks:
web:
external: true
name: traefik_web2

The issue I'm facing is that when I enable the following lines, which are responsible for HTTP-to-HTTPS redirection, I get the error "invalid entry point 'http' address: missing port in address":

yaml

  - "--entryPoints.http.address=:80"
  - "--entrypoints.https.http.tls.certResolver=le"

The error message I receive is as follows:

swift

time="2023-08-25T20:46:57Z" level=info msg="Configuration loaded from flags."
time="2023-08-25T20:46:57Z" level=error msg="invalid entry point "http" address "": missing port in address" providerName=internal entryPointName=http

If I comment out these lines, the error disappears, but I also lose the SSL certificate. I'm using Let's Encrypt as the certificate resolver.

I've checked my domain configurations and they seem to be correct. My services are accessible via HTTPS, but without SSL certificates.

Can someone help me understand what I might be doing wrong here? Is there a better way to set up HTTP-to-HTTPS redirection with SSL certificates in Traefik?

Thank you in advance for any guidance or suggestions!

Best regards,
Heiko m.

Format your code with 3 backticks in front and after, or select the code and press </>. In yaml every space matters.

Maybe compare with the simple Traefik example.

1 Like