Skip to content

Unable to create redirect from http to https #4319

@tylerball

Description

@tylerball

Do you want to request a feature or report a bug?

Bug

What did you do?

What did you expect to see?

Setting up redirection from http to https as per docs.

What did you see instead?

I get an error:

traefik          | 2018-12-19T19:17:42.568235066Z time="2018-12-19T19:17:42Z" level=info msg="Preparing server https &{Address: TLS:0xc00026ec60 Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc000380a00} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik          | 2018-12-19T19:17:43.200101970Z time="2018-12-19T19:17:43Z" level=debug msg="Creating entry point redirect http -> https"
traefik          | 2018-12-19T19:17:43.200138483Z time="2018-12-19T19:17:43Z" level=fatal msg="Error preparing server: failed to create redirect middleware: error loading configuration for entrypoint http: bad Address format \"\""

Output of traefik version: (What version of Traefik are you using?)

Version:      v1.7.6
Codename:     maroilles
Go version:   go1.11.3
Built:        2018-12-14_06:43:37AM
OS/Arch:      linux/amd64

What is your environment & configuration (arguments, toml, provider, platform, ...)?

debug = true
logLevel = "DEBUG"
InsecureSkipVerify = true
defaultEntryPoints = ["https", "http"]

[entryPoints]
  [entryPoints.https]
  address = ":443"
    [entrypoints.https.tls]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"

[acme]
email = "tyler@tylerball.net"
storage = "/etc/traefik/acme/acme.json"
entryPoint = "https"
acmeLogging=true
onDemand = false
[acme.dnsChallenge]
  provider = "linode"
  delayBeforeCheck = 0
[[acme.domains]]
  main = "<redacted>"
[[acme.domains]]
  main = "*.<redacted>"

[file]
watch = true

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "<redacted>"
exposedByDefault = false
watch = true

[api]
  entryPoint = "traefik"
  dashboard = true
  address = ":8080"

[accessLog]
  filePath = "/etc/traefik/access.log"

My docker-compose is:

version: "3"

services:
  traefik:
    hostname: traefik
    image: traefik:latest
    container_name: traefik
    domainname: {{ url }}
    networks:
      - local
      - traefik_proxy
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    environment:
      - "LINODE_API_KEY={{ linode_api_key }}"
      - TZ=America/Toronto
    volumes:
      - "/home/tball/traefik:/etc/traefik"
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - "traefik.enable=true"
      - "traefik.backend=traefik"
      - "traefik.frontend.rule=Host:traefik.{{ url }}"
      - "traefik.port=8080"
      - "traefik.docker.network=traefik_proxy"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.headers.STSSeconds=315360000"
      - "traefik.frontend.headers.browserXSSFilter=true"
      - "traefik.frontend.headers.contentTypeNosniff=true"
      - "traefik.frontend.headers.forceSTSHeader=true"
      - "traefik.frontend.headers.SSLHost={{ url }}"
      - "traefik.frontend.headers.STSIncludeSubdomains=true"
      - "traefik.frontend.headers.STSPreload=true"
      - "traefik.frontend.headers.frameDeny=true"
    restart: always
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:latest
    depends_on:
      - traefik
    volumes:
      - "/home/tball/.homeassistant:/config"
      - /etc/localtime:/etc/localtime:ro
    labels:
      - traefik.enable=true
      - traefik.backend=homeassistant
      - "traefik.frontend.rule=Host:{{ url }}"
      - traefik.port=8123
      - traefik.docker.network=traefik_proxy
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.headers.STSSeconds=315360000"
      - "traefik.frontend.headers.browserXSSFilter=true"
      - "traefik.frontend.headers.contentTypeNosniff=true"
      - "traefik.frontend.headers.forceSTSHeader=true"
      - "traefik.frontend.headers.SSLHost={{ url }}"
      - "traefik.frontend.headers.STSIncludeSubdomains=true"
      - "traefik.frontend.headers.STSPreload=true"
      - "traefik.frontend.headers.frameDeny=true"
    networks:
      - traefik_proxy
      - local
    ports:
      - 8123:8123
    environment:
      - TZ=America/Toronto
    restart: unless-stopped
networks:
  traefik_proxy:
    external:
      name: traefik_proxy
  local:
    driver: bridge

If applicable, please paste the log output in DEBUG level (--logLevel=DEBUG switch)

Full log:

traefik          | 2018-12-19T19:29:59.761204489Z time="2018-12-19T19:29:59Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml"
traefik          | 2018-12-19T19:29:59.761250143Z time="2018-12-19T19:29:59Z" level=info msg="Traefik version v1.7.6 built on 2018-12-14_06:43:37AM"
traefik          | 2018-12-19T19:29:59.762961538Z time="2018-12-19T19:29:59Z" level=debug msg="Global configuration loaded {\"LifeCycle\":{\"RequestAcceptGraceTimeout\":0,\"GraceTimeOut\":10000000000},\"GraceTimeOut\":0,\"Debug\":true,\"CheckNewVersion\":true,\"SendAnonymousUsage\":false,\"AccessLogsFile\":\"\",\"AccessLog\":{\"file\":\"/etc/traefik/access.log\",\"format\":\"common\"},\"TraefikLogsFile\":\"\",\"TraefikLog\":null,\"Tracing\":null,\"LogLevel\":\"DEBUG\",\"EntryPoints\":{\"http\":{\"Address\":\":80\",\"TLS\":null,\"Redirect\":{\"entryPoint\":\"https\"},\"Auth\":null,\"WhitelistSourceRange\":null,\"WhiteList\":null,\"Compress\":false,\"ProxyProtocol\":null,\"ForwardedHeaders\":{\"Insecure\":true,\"TrustedIPs\":null}},\"https\":{\"Address\":\"\",\"TLS\":{\"MinVersion\":\"\",\"CipherSuites\":null,\"Certificates\":null,\"ClientCAFiles\":null,\"ClientCA\":{\"Files\":null,\"Optional\":false},\"DefaultCertificate\":null,\"SniStrict\":false},\"Redirect\":null,\"Auth\":null,\"WhitelistSourceRange\":null,\"WhiteList\":null,\"Compress\":false,\"ProxyProtocol\":null,\"ForwardedHeaders\":{\"Insecure\":true,\"TrustedIPs\":null}},\"traefik\":{\"Address\":\":8080\",\"TLS\":null,\"Redirect\":null,\"Auth\":null,\"WhitelistSourceRange\":null,\"WhiteList\":null,\"Compress\":false,\"ProxyProtocol\":null,\"ForwardedHeaders\":{\"Insecure\":true,\"TrustedIPs\":null}}},\"Cluster\":null,\"Constraints\":[],\"ACME\":{\"Email\":\"tyler@tylerball.net\",\"Domains\":[{\"Main\":\"redacted.com\",\"SANs\":null},{\"Main\":\"*.redacted.com\",\"SANs\":null}],\"Storage\":\"/etc/traefik/acme/acme.json\",\"StorageFile\":\"\",\"OnDemand\":false,\"OnHostRule\":false,\"CAServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"EntryPoint\":\"https\",\"KeyType\":\"\",\"DNSChallenge\":{\"Provider\":\"linode\",\"DelayBeforeCheck\":0,\"Resolvers\":null,\"DisablePropagationCheck\":false},\"HTTPChallenge\":null,\"TLSChallenge\":null,\"DNSProvider\":\"\",\"DelayDontCheckDNS\":0,\"ACMELogging\":true,\"OverrideCertificates\":false,\"TLSConfig\":null},\"DefaultEntryPoints\":[\"https\",\"http\"],\"ProvidersThrottleDuration\":2000000000,\"MaxIdleConnsPerHost\":200,\"IdleTimeout\":0,\"InsecureSkipVerify\":true,\"RootCAs\":null,\"Retry\":null,\"HealthCheck\":{\"Interval\":30000000000},\"RespondingTimeouts\":null,\"ForwardingTimeouts\":null,\"AllowMinWeightZero\":false,\"KeepTrailingSlash\":false,\"Web\":null,\"Docker\":{\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":2,\"DebugLogGeneratedTemplate\":false,\"Endpoint\":\"unix:///var/run/docker.sock\",\"Domain\":\"redacted.com\",\"TLS\":null,\"ExposedByDefault\":false,\"UseBindPortIP\":false,\"SwarmMode\":false,\"Network\":\"\",\"SwarmModeRefreshSeconds\":15},\"File\":{\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":0,\"DebugLogGeneratedTemplate\":false,\"Directory\":\"\",\"TraefikFile\":\"/etc/traefik/traefik.toml\"},\"Marathon\":null,\"Consul\":null,\"ConsulCatalog\":null,\"Etcd\":null,\"Zookeeper\":null,\"Boltdb\":null,\"Kubernetes\":null,\"Mesos\":null,\"Eureka\":null,\"ECS\":null,\"Rancher\":null,\"DynamoDB\":null,\"ServiceFabric\":null,\"Rest\":null,\"API\":{\"EntryPoint\":\"traefik\",\"Dashboard\":true,\"Debug\":true,\"CurrentConfigurations\":null,\"Statistics\":null},\"Metrics\":null,\"Ping\":null,\"HostResolver\":null}"
traefik          | 2018-12-19T19:29:59.763106798Z time="2018-12-19T19:29:59Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/basics/#collected-data\n"
traefik          | 2018-12-19T19:29:59.764242033Z time="2018-12-19T19:29:59Z" level=debug msg="Setting Acme Certificate store from Entrypoint: https"
traefik          | 2018-12-19T19:30:00.822820156Z time="2018-12-19T19:30:00Z" level=info msg="Preparing server https &{Address: TLS:0xc000287200 Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0005220c0} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik          | 2018-12-19T19:30:01.246789735Z time="2018-12-19T19:30:01Z" level=debug msg="Creating entry point redirect http -> https"
traefik          | 2018-12-19T19:30:01.247248065Z time="2018-12-19T19:30:01Z" level=info msg="Starting server on "
traefik          | 2018-12-19T19:30:01.247700557Z time="2018-12-19T19:30:01Z" level=fatal msg="Error preparing server: failed to create redirect middleware: error loading configuration for entrypoint http: bad Address format \"\""

I've also noticed if I remove the lines:

    [entryPoints.http.redirect]
    entryPoint = "https"

from the config I don't get an error but I also don't see traefik ever mentioning listening on port 443 in the logs, only:

traefik          | 2018-12-19T19:36:07.361023213Z time="2018-12-19T19:36:07Z" level=info msg="Server configuration reloaded on "
traefik          | 2018-12-19T19:36:07.361034684Z time="2018-12-19T19:36:07Z" level=info msg="Server configuration reloaded on :80"
traefik          | 2018-12-19T19:36:07.361042870Z time="2018-12-19T19:36:07Z" level=info msg="Server configuration reloaded on :8080"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions