Global Http to Https Redirect not working

Global Http to Https Redirect not working. Getting an Redirection-Error, no acess to exposed pages.

Docker Stack:

version: "3.3"

services:
  traefik:
    image: traefik:latest
    ports:
      - "80:80"
      - "8080:8080"
      - "443:443"
    command:
      - "--api.insecure=true"
      - "--api.dashboard=true"
      - "--api.debug=true"
      - "--log.level=DEBUG"
      - "--providers.docker=true"
      - "--providers.docker.swarmMode=true"
      - "--providers.docker.exposedbydefault=false"
      - "--providers.docker.network=web"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web-secure.address=:443"
      - "--entrypoints.web.http.redirections.entryPoint.to=web-secure"
      - "--entrypoints.web.http.redirections.entryPoint.scheme=https"
      - "--certificatesresolvers.ssl.acme.httpChallenge=true"
      - "--certificatesresolvers.ssl.acme.email=admin@example.com"
      - "--certificatesresolvers.ssl.acme.storage=/letsencrypt/acme.json"
    volumes:
      - /nfs/infra/traefik/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - web
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]
    
networks:
  web:
    external: true
  intern:
    external: true

You have

  • "--entrypoints.web.http.redirections.entryPoint.to=web-secure"
  • "--entrypoints.web.http.redirections.entryPoint.scheme=https"

I think it should be

  • "--entrypoints.web.http.redirections.entryPoint.to=web-secure"
  • "--entrypoints.web.http.redirections.entryPoint.scheme=web-secure"

@rit001 the scheme is not an entrypoint, it's a scheme: http, https, ...


@hase808 can you provide your logs, more detail about your current behavior, the configuration of services, etc. ?

service-configuration.yml

version: '3.7'

networks:
 web:
    external: true

services:
  jira:
     image: ghcr.io/hase808/jira:0.1
     networks:
       - web
     deploy:
       mode: replicated
       replicas: 1
       placement:
         constraints: [node.role == worker]  
       labels:
         - traefik.enable=true
         - traefik.http.routers.jira.entrypoints=http
         - traefik.http.routers.jira.rule=Host(`jira.unhappy.computer`)
         - traefik.http.routers.jira-secure.entrypoints=https
         - traefik.http.routers.jira-secure.rule=Host(`jira.unhappy.computer`)
         - traefik.http.routers.jira-secure.tls.certresolver=ssl
         - traefik.http.services.jira.loadbalancer.server.port=8080
         - traefik.docker.network=web

Logs:

time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" routerName=web-to-web-secure@internal entryPointName=web middlewareName=redirect-web-to-web-secure@internal middlewareType=RedirectScheme
time="2022-03-06T13:34:20Z" level=debug msg="Setting up redirection to https 443" entryPointName=web middlewareName=redirect-web-to-web-secure@internal middlewareType=RedirectScheme routerName=web-to-web-secure@internal
time="2022-03-06T13:34:20Z" level=debug msg="Adding tracing to middleware" entryPointName=web middlewareName=redirect-web-to-web-secure@internal routerName=web-to-web-secure@internal
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" entryPointName=web middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2022-03-06T13:34:20Z" level=debug msg="No default certificate, generating one" tlsStoreName=default
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" entryPointName=web routerName=confluence@docker middlewareName=pipelining middlewareType=Pipelining serviceName=confluence
time="2022-03-06T13:34:20Z" level=debug msg="Creating load-balancer" entryPointName=web routerName=confluence@docker serviceName=confluence
time="2022-03-06T13:34:20Z" level=debug msg="Creating server 0 http://ipv4:8090" routerName=confluence@docker serviceName=confluence serverName=0 entryPointName=web
time="2022-03-06T13:34:20Z" level=debug msg="child http://ipv4:8090 now UP"
time="2022-03-06T13:34:20Z" level=debug msg="Propagating new UP status"
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware confluence" middlewareType=TracingForwarder middlewareName=tracing entryPointName=web routerName=confluence@docker
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" entryPointName=web routerName=vaultwarden@docker serviceName=vaultwarden middlewareName=pipelining middlewareType=Pipelining
time="2022-03-06T13:34:20Z" level=debug msg="Creating load-balancer" entryPointName=web routerName=vaultwarden@docker serviceName=vaultwarden
time="2022-03-06T13:34:20Z" level=debug msg="Creating server 0 http://ipv4:80" serverName=0 entryPointName=web routerName=vaultwarden@docker serviceName=vaultwarden
time="2022-03-06T13:34:20Z" level=debug msg="child http://ipv4:80 now UP"
time="2022-03-06T13:34:20Z" level=debug msg="Propagating new UP status"
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware vaultwarden" entryPointName=web routerName=vaultwarden@docker middlewareName=tracing middlewareType=TracingForwarder
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" serviceName=nextcloud middlewareName=pipelining middlewareType=Pipelining entryPointName=web routerName=nextcloud@docker
time="2022-03-06T13:34:20Z" level=debug msg="Creating load-balancer" routerName=nextcloud@docker serviceName=nextcloud entryPointName=web
time="2022-03-06T13:34:20Z" level=debug msg="Creating server 0 http://ipv4:80" entryPointName=web routerName=nextcloud@docker serviceName=nextcloud serverName=0
time="2022-03-06T13:34:20Z" level=debug msg="child http://ipv4:80 now UP"
time="2022-03-06T13:34:20Z" level=debug msg="Propagating new UP status"
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware nextcloud" routerName=nextcloud@docker entryPointName=web middlewareName=tracing middlewareType=TracingForwarder
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" entryPointName=web middlewareName=nextcloud-redirect-web-secure@docker middlewareType=RedirectScheme routerName=nextcloud@docker
time="2022-03-06T13:34:20Z" level=debug msg="Setting up redirection to https " routerName=nextcloud@docker entryPointName=web middlewareName=nextcloud-redirect-web-secure@docker middlewareType=RedirectScheme
time="2022-03-06T13:34:20Z" level=debug msg="Adding tracing to middleware" routerName=nextcloud@docker middlewareName=nextcloud-redirect-web-secure@docker entryPointName=web
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware noop@internal" middlewareType=TracingForwarder entryPointName=web routerName=web-to-web-secure@internal middlewareName=tracing
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" middlewareName=redirect-web-to-web-secure@internal middlewareType=RedirectScheme entryPointName=web routerName=web-to-web-secure@internal
time="2022-03-06T13:34:20Z" level=debug msg="Setting up redirection to https 443" routerName=web-to-web-secure@internal middlewareName=redirect-web-to-web-secure@internal middlewareType=RedirectScheme entryPointName=web
time="2022-03-06T13:34:20Z" level=debug msg="Adding tracing to middleware" entryPointName=web routerName=web-to-web-secure@internal middlewareName=redirect-web-to-web-secure@internal
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" entryPointName=web middlewareType=Recovery middlewareName=traefik-internal-recovery
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware api@internal" middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik routerName=api@internal
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware api@internal" entryPointName=traefik routerName=debug@internal middlewareName=tracing middlewareType=TracingForwarder
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" routerName=dashboard@internal entryPointName=traefik middlewareName=tracing middlewareType=TracingForwarder
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" middlewareName=dashboard_stripprefix@internal entryPointName=traefik routerName=dashboard@internal middlewareType=StripPrefix
time="2022-03-06T13:34:20Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
time="2022-03-06T13:34:20Z" level=debug msg="Setting up redirection from ^(http:\\/\\/(\\[[\\w:.]+\\]|[\\w\\._-]+)(:\\d+)?)\\/$ to ${1}/dashboard/" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
time="2022-03-06T13:34:20Z" level=debug msg="Adding tracing to middleware" middlewareName=dashboard_redirect@internal routerName=dashboard@internal entryPointName=traefik
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" middlewareType=Recovery entryPointName=traefik middlewareName=traefik-internal-recovery
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" serviceName=nextcloud middlewareName=pipelining middlewareType=Pipelining entryPointName=web-secure routerName=nextcloud-secure@docker
time="2022-03-06T13:34:20Z" level=debug msg="Creating load-balancer" routerName=nextcloud-secure@docker serviceName=nextcloud entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="Creating server 0 http://ipv4:80" routerName=nextcloud-secure@docker serviceName=nextcloud serverName=0 entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="child http://ipv4:80 now UP"
time="2022-03-06T13:34:20Z" level=debug msg="Propagating new UP status"
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware nextcloud" routerName=nextcloud-secure@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" routerName=vaultwarden-secure@docker middlewareName=pipelining middlewareType=Pipelining serviceName=vaultwarden entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="Creating load-balancer" entryPointName=web-secure routerName=vaultwarden-secure@docker serviceName=vaultwarden
time="2022-03-06T13:34:20Z" level=debug msg="Creating server 0 http://ipv4:80" serverName=0 entryPointName=web-secure routerName=vaultwarden-secure@docker serviceName=vaultwarden
time="2022-03-06T13:34:20Z" level=debug msg="child http://ipv4:80 now UP"
time="2022-03-06T13:34:20Z" level=debug msg="Propagating new UP status"
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware vaultwarden" middlewareType=TracingForwarder entryPointName=web-secure routerName=vaultwarden-secure@docker middlewareName=tracing
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" entryPointName=web-secure routerName=confluence-secure@docker serviceName=confluence middlewareName=pipelining middlewareType=Pipelining
time="2022-03-06T13:34:20Z" level=debug msg="Creating load-balancer" entryPointName=web-secure routerName=confluence-secure@docker serviceName=confluence
time="2022-03-06T13:34:20Z" level=debug msg="Creating server 0 http://ipv4:8090" serviceName=confluence serverName=0 entryPointName=web-secure routerName=confluence-secure@docker
time="2022-03-06T13:34:20Z" level=debug msg="child http://ipv4:8090 now UP"
time="2022-03-06T13:34:20Z" level=debug msg="Propagating new UP status"
time="2022-03-06T13:34:20Z" level=debug msg="Added outgoing tracing middleware confluence" entryPointName=web-secure routerName=confluence-secure@docker middlewareName=tracing middlewareType=TracingForwarder
time="2022-03-06T13:34:20Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="Adding route for confluence.unhappy.computer with TLS options default" entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="Adding route for vaultwarden.unhappy.computer with TLS options default" entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="Adding route for nextcloud.unhappy.computer with TLS options default" entryPointName=web-secure
time="2022-03-06T13:34:20Z" level=debug msg="Try to challenge certificate for domain [vaultwarden.unhappy.computer] found in HostSNI rule" routerName=vaultwarden-secure@docker rule="Host(`vaultwarden.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory"
time="2022-03-06T13:34:20Z" level=debug msg="Try to challenge certificate for domain [confluence.unhappy.computer] found in HostSNI rule" routerName=confluence-secure@docker rule="Host(`confluence.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory"
time="2022-03-06T13:34:20Z" level=debug msg="Try to challenge certificate for domain [nextcloud.unhappy.computer] found in HostSNI rule" routerName=nextcloud-secure@docker rule="Host(`nextcloud.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory"
time="2022-03-06T13:34:20Z" level=debug msg="Looking for provided certificate(s) to validate [\"nextcloud.unhappy.computer\"]..." providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=nextcloud-secure@docker rule="Host(`nextcloud.unhappy.computer`)"
time="2022-03-06T13:34:20Z" level=debug msg="Domains [\"nextcloud.unhappy.computer\"] need ACME certificates generation for domains \"nextcloud.unhappy.computer\"." routerName=nextcloud-secure@docker rule="Host(`nextcloud.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory"
time="2022-03-06T13:34:20Z" level=debug msg="Loading ACME certificates [nextcloud.unhappy.computer]..." providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=nextcloud-secure@docker rule="Host(`nextcloud.unhappy.computer`)"
time="2022-03-06T13:34:20Z" level=debug msg="Building ACME client..." providerName=ssl.acme
time="2022-03-06T13:34:20Z" level=debug msg="https://acme-v02.api.letsencrypt.org/directory" providerName=ssl.acme
time="2022-03-06T13:34:20Z" level=debug msg="Looking for provided certificate(s) to validate [\"vaultwarden.unhappy.computer\"]..." providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=vaultwarden-secure@docker rule="Host(`vaultwarden.unhappy.computer`)"
time="2022-03-06T13:34:20Z" level=debug msg="Domains [\"vaultwarden.unhappy.computer\"] need ACME certificates generation for domains \"vaultwarden.unhappy.computer\"." routerName=vaultwarden-secure@docker rule="Host(`vaultwarden.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory"
22-03-06T13:34:20Z" level=debug msg="Loading ACME certificates [vaultwarden.unhappy.computer]..." providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=vaultwarden-secure@docker rule="Host(`vaultwarden.unhappy.computer`)"
time="2022-03-06T13:34:20Z" level=debug msg="Looking for provided certificate(s) to validate [\"confluence.unhappy.computer\"]..." ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=confluence-secure@docker rule="Host(`confluence.unhappy.computer`)" providerName=ssl.acme
time="2022-03-06T13:34:20Z" level=debug msg="Domains [\"confluence.unhappy.computer\"] need ACME certificates generation for domains \"confluence.unhappy.computer\"." routerName=confluence-secure@docker rule="Host(`confluence.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory"
time="2022-03-06T13:34:20Z" level=debug msg="Loading ACME certificates [confluence.unhappy.computer]..." rule="Host(`confluence.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=confluence-secure@docker
time="2022-03-06T13:34:21Z" level=error msg="Unable to obtain ACME certificate for domains \"nextcloud.unhappy.computer\": cannot get ACME client ACME challenge not specified, please select TLS or HTTP or DNS Challenge" ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=nextcloud-secure@docker rule="Host(`nextcloud.unhappy.computer`)" providerName=ssl.acme
time="2022-03-06T13:34:21Z" level=debug msg="Building ACME client..." providerName=ssl.acme
time="2022-03-06T13:34:21Z" level=debug msg="https://acme-v02.api.letsencrypt.org/directory" providerName=ssl.acme
time="2022-03-06T13:34:21Z" level=error msg="Unable to obtain ACME certificate for domains \"vaultwarden.unhappy.computer\": cannot get ACME client ACME challenge not specified, please select TLS or HTTP or DNS Challenge" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=vaultwarden-secure@docker rule="Host(`vaultwarden.unhappy.computer`)"
time="2022-03-06T13:34:21Z" level=debug msg="Building ACME client..." providerName=ssl.acme
time="2022-03-06T13:34:21Z" level=debug msg="https://acme-v02.api.letsencrypt.org/directory" providerName=ssl.acme
time="2022-03-06T13:34:22Z" level=error msg="Unable to obtain ACME certificate for domains \"confluence.unhappy.computer\": cannot get ACME client ACME challenge not specified, please select TLS or HTTP or DNS Challenge" routerName=confluence-secure@docker rule="Host(`confluence.unhappy.computer`)" providerName=ssl.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory"
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=traefik-traefik-9vw9aolnavi1057tdbsbvilcd
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=confluence-bkp-u3e8b1pxhudiwdhblvy7mvw9a
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=portainer-portainer-hbus3j8ovgtrd5qepm594rxcp
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=confluence-confluence-database-81d3ynocojfmn9mhuemwdrj2y
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" container=nextcloud-nextcloud-db-y6yyd2mk5aec4jt57ip4yqhcj providerName=docker
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=portainer-bkp-johng78moqcw3jkqis135twlv
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" container=portainer-agent-eulbjyvcr01fyn7peqxaexh9v providerName=docker
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=portainer-agent-s1a5s8lq74em4d5klclb8oann
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" container=portainer-agent-xsvzjbgp46a7j9nc9mf1rzun7 providerName=docker
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=portainer-agent-yncdjnfg6s88zmhbtqlgqfjkt
time="2022-03-06T13:34:35Z" level=error msg="field not found, node: entrypoint" providerName=docker container=jira-jira-it90imgdkvurf5kk7spf23mvk
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=cloudflare-ddns-cloudflare-ddns-hryiqezfzbf4rrrj7hnh5gija
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" container=jira-jira-database-7uth4pgd0m8vug2qyn37bnzw9 providerName=docker
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" container=nextcloud-bkp-wiek5f3chb8agu605j8xzno8g providerName=docker
time="2022-03-06T13:34:35Z" level=debug msg="Filtering disabled container" providerName=docker container=jira-bkp-uw25a4i3003ii4mbzggib1vst
time="2022-03-06T13:34:35Z" level=debug msg="Configuration received from provider docker: {\"http\":{\"routers\":{\"confluence\":{\"entryPoints\":[\"web\"],\"service\":\"confluence\",\"rule\":\"Host(`confluence.unhappy.computer`)\"},\"confluence-secure\":{\"entryPoints\":[\"web-secure\"],\"service\":\"confluence\",\"rule\":\"Host(`confluence.unhappy.computer`)\",\"tls\":{\"certResolver\":\"ssl\"}},\"nextcloud\":{\"entryPoints\":[\"web\"],\"middlewares\":[\"nextcloud-redirect-web-secure\"],\"service\":\"nextcloud\",\"rule\":\"Host(`nextcloud.unhappy.computer`)\"},\"nextcloud-secure\":{\"entryPoints\":[\"web-secure\"],\"service\":\"nextcloud\",\"rule\":\"Host(`nextcloud.unhappy.computer`)\",\"tls\":{\"certResolver\":\"ssl\"}},\"vaultwarden\":{\"entryPoints\":[\"web\"],\"service\":\"vaultwarden\",\"rule\":\"Host(`vaultwarden.unhappy.computer`)\"},\"vaultwarden-secure\":{\"entryPoints\":[\"web-secure\"],\"service\":\"vaultwarden\",\"rule\":\"Host(`vaultwarden.unhappy.computer`)\",\"tls\":{\"certResolver\":\"ssl\"}}},\"services\":{\"confluence\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://ipv4:8090\"}],\"passHostHeader\":true}},\"nextcloud\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://ipv4:80\"}],\"passHostHeader\":true}},\"vaultwarden\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://ipv4:80\"}],\"passHostHeader\":true}}},\"middlewares\":{\"nextcloud-redirect-web-secure\":{\"redirectScheme\":{\"scheme\":\"https\"}}}},\"tcp\":{},\"udp\":{}}" providerName=docker
time="2022-03-06T13:34:35Z" level=debug msg="Skipping same configuration" providerName=docker

When using the redirect deployed through the command section, I cant access the website on https or http.

Error: Redirection Error, no acess to web-site

The entrypoint names (http, https) that you are using on your routers are not the same as the entrypoint definitions (web, web-secure)

The right approach:

       labels:
         - traefik.enable=true
         - traefik.http.routers.jira.entrypoints=web,web-secure
         - traefik.http.routers.jira.rule=Host(`jira.unhappy.computer`)