V2 404 on HTTPS

Hello,

I am currently moving from v1 to v2. I have several docker containers behind Traefik which are reachable via http.

I am now trying to configure also https->traefik->http-> container. I am using defaultRule to map URLs to containers and assigned a default certificate. The certificate is presented to the browser but I get 404 on all https requests while http is still working.

I just need an idea where to look.

Regards
Shadow256

traefik.toml

################################################################
# Global configuration
################################################################
[global]
  checkNewVersion = true
  sendAnonymousUsage = false

################################################################
# Entrypoints configuration
################################################################

# Entrypoints definition
#
# Optional
# Default:
[entryPoints]
  [entryPoints.http]
    address = ":80"

  [entryPoints.https]
    address = ":443"


################################################################
# API and dashboard configuration
################################################################

# Enable API and dashboard
[api]

  dashboard = true
  insecure = true

################################################################
# Docker configuration backend
################################################################

# Enable Docker configuration backend
[providers.docker]

  # Default host rule.
  #
  # Optional
  # Default: "Host(`{{ normalize .Name }}`)"
  #
  # defaultRule = "Host(`{{ normalize .Name }}.docker.localhost`)"
  defaultRule = "Host(`{{ normalize .Name }}.xxx.home`)"

[providers.file]
    directory = "/etc/traefik/config"
    watch = "true"

tls.toml

[[tls.certificates]]
	certFile = "/certs/joker_crt.pem"
  	keyFile = "/certs/joker_key.pem"
	stores = ["default"]

[tls.stores]
  [tls.stores.default]
    [tls.stores.default.defaultCertificate]
  	certFile = "/certs/joker_crt.pem"
  	keyFile = "/certs/joker_key.pem"

Hello @Shadow256,

Can you please provide an example container and its labels so that we can see what you are attempting to do?

Hello @daniel.tomcej ,

I am trying e.g. Portainer, container name is portainer, no labels configured.

http://portainer.xxx.home works
https://portainer.xxx.home shows the valid certificate and 404 afterwards

Looks like you'd need to add some labels to make that work - see documentation. Traefik will create a single router by default - that's what you are seeing, but that never will be a TLS router. If you want also a TLS one you need configure traefik to create it.

Maybe have a look here.

V2 https example

But it's still not solved :-/

That was the point into the right direction. I added folowing routers:

[http.routers]
  [http.routers.my-https-router]
    rule = "Host(`portainer.xxx.home`)"
    service = "portainer@docker"
    # will terminate the TLS request
    [http.routers.my-https-router.tls]

  [http.routers.my-http-router]
    rule = "Host(`portainer.xxx.home`)"
    service = "portainer@docker"

It is working now.

Thank you for your support.

Edit: Moved the config to labes now, still working.

1 Like