Another redirect problem

I run a calibre-web container behind traefik (2.3.1) using LetsEncrypt for TLS enablement.

If i type in my https URL to the calibre service, i got a ERR_ADDRESS_UNREACHABLE and the Browser shows up the same URL without (s) http. If i type in the https adress again - it works.

What i have done so far. As mentionend in this forum, the problem lies mostly on the application container side. And yes, i found a problem description here that matched to my issue. But i am using a container where that issue already fixed.
Actually i run the traefik container in DEBUG mode and compared the good an bad request with each other. Nothing suspicious found. The X-Forward Headers filled correctly.

Just to be sure. I am very new to use traefik. Perhaps an Expert can check my docker-compose configuration?

traefik.yml

## STATIC CONFIGURATION
log:
  level: DEBUG

api:
  insecure: true
  dashboard: true

entryPoints:
  web:
    address: ":80"
  websecure:
    address: ":443"

providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false

certificatesResolvers:
  lets-encr:
    acme:
      #caServer: https://acme-staging-v02.api.letsencrypt.org/directory
      email: [myadress]
      storage: acme.json
      dnsChallenge:
        provider: cloudflare
        resolvers:
          - "1.1.1.1:53"
          - "8.8.8.8:53"

docker-compose-traefik.yml

version: "3.7"

services:
  traefik:
    image: "traefik:latest"
    container_name: "traefik"
    hostname: "[hostname replaced]"
    env_file:
      - .env
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik.yml:/traefik.yml:ro"
      - "./acme.json:/acme.json"

    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.tls.certresolver=lets-encr"
      - "traefik.http.routers.traefik.tls.domains[0].main=*.$MY_DOMAIN"
      - "traefik.http.routers.traefik.tls.domains[0].sans=$MY_DOMAIN"
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.permanent=true"
      - "traefik.http.routers.redirect-https.rule=hostregexp(`{host:.+}`)"
      - "traefik.http.routers.redirect-https.entrypoints=web"
      - "traefik.http.routers.redirect-https.middlewares=redirect-to-https"

networks:
  default:
    external:
      name: $DEFAULT_NETWORK

docker-compose-calibre-web.yml

version: "3.7"

services:
  calibre-web:
    image: linuxserver/calibre-web:latest
    container_name: calibre_web
    hostname: calibre
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.calibre.entrypoints=websecure"
      - "traefik.http.routers.calibre.rule=Host(`calibre.$MY_DOMAIN`)"
      - "traefik.http.routers.calibre.tls.certresolver=lets-encr"
      - "traefik.http.routers.calibre.tls.domains[0].main=calibre.$MY_DOMAIN"

    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
    volumes:
      - /home/pirate/calibre/config:/config
      - /home/pirate/calibre/books:/books
    ports:
      - 8083:8083
    restart: unless-stopped

networks:
  default:
    external:
      name: $DEFAULT_NETWORK

Any help, to narrow down the issue are really appreciated. The guys from the linuxserver.io team send me over here.

Hello,

I tried with the following files, and I don't have any issues.

I recommend trying with my files, and check the value of $DEFAULT_NETWORK

version: "3.7"

services:
  traefik:
    image: traefik:v2.3.1
    container_name: traefik
    hostname: traefik
    env_file:
      - .env
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./acme.json:/acme.json
    command:
      - --log.level=INFO
      - --api

      - --entrypoints.web.address=:80
      - --entrypoints.web.http.redirections.entryPoint.to=websecure
      - --entrypoints.web.http.redirections.entrypoint.scheme=https

      - --entrypoints.websecure.address=:443
      - --entrypoints.websecure.http.tls=true
      - --entrypoints.websecure.http.tls.certresolver=lets-encr
      - --entrypoints.websecure.http.tls.domains[0].main=${MY_DOMAIN}
      - --entrypoints.websecure.http.tls.domains[0].sans=*.${MY_DOMAIN}
      
      - --providers.docker

      - --certificatesresolvers.lets-encr.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
      - --certificatesresolvers.lets-encr.acme.dnschallenge.provider=cloudflare
      - --certificatesresolvers.lets-encr.acme.dnschallenge.resolvers=1.1.1.1:53, 8.8.8.8:53
      - --certificatesresolvers.lets-encr.acme.email=myadress
      - --certificatesresolvers.lets-encr.acme.storage=acme.json
    labels:
      traefik.enable: 'true'

      # Dashboard
      traefik.http.routers.traefik.rule: Host(`traefik.${MY_DOMAIN}`)
      traefik.http.routers.traefik.entrypoints: web,websecure
      traefik.http.routers.traefik.service: api@internal

networks:
  default:
    external:
      name: $DEFAULT_NETWORK
version: "3.7"

services:
  calibre-web:
    image: linuxserver/calibre-web:latest
    container_name: calibre_web
    hostname: calibre
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
    volumes:
      - /home/pirate/calibre/config:/config
      - /home/pirate/calibre/books:/books
    ports:
      - 8083:8083
    restart: unless-stopped
    labels:
      traefik.enable: 'true'
      
      traefik.http.routers.calibre.rule: Host(`calibre.${MY_DOMAIN}`)
      traefik.http.routers.calibre.entrypoints: web,websecure

networks:
  default:
    external:
      name: $DEFAULT_NETWORK

... I tried as recommended. Now i struggle with the startup of the traefik container:

2020/10/03 16:46:48 command traefik error: failed to decode configuration from flags: field not found, node: resolver

Any hint?

I made a mistake, you have to replace:

- --entrypoints.websecure.http.tls.resolver=lets-encr

by

- --entrypoints.websecure.http.tls.certresolver=lets-encr

Be honest, this was a test, if i figure out the mistake by myself. :wink:

OK, after fixing the line, the container starts, but unfortunatly the issue persists.
If there any other tip i am happy to try it.

[edit] I don't think so, but i am using Cloudflare. (Turned off the SSL Proxy) Perhaps that a problem?

At the moment i updated the application container to calibre-web 0.6.9.
What should i say - it works!

Obvious, it was something wrong on the application side.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.