Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1501

traefik doesn't redirect http to https

$
0
0

I'm new in traefik, and couldn't understand why it doesn't redirect.I saw a lot ways how to do redirect , and this one pretty match for me, because i want, that redirect works on the all routers.Especially I don't want to write redirect to labels of every router

docker-compose.yml

services:  traefik:    image: traefik:v2.5    container_name: traefik    restart: unless-stopped    security_opt:      - no-new-privileges:true    ports:      - 80:80      - 443:443       - 8082:8082    volumes:      - /etc/localtime:/etc/localtime:ro      - /var/run/docker.sock:/var/run/docker.sock:ro      - ./data/traefik.yml:/traefik.yml:ro      - ./data/custom/:/custom/:ro      - ./data/acme.json:/acme.json    labels:      - "traefik.enable=true"      - "traefik.http.routers.traefik.rule=Host(`traefik.example.com`)"      - "traefik.http.routers.traefik.tls=true"      - "traefik.http.routers.traefik.tls.certresolver=letsEncrypt"      - "traefik.http.routers.traefik.service=api@internal"      - "traefik.http.services.traefik-traefik.loadbalancer.server.port=888"      - "traefik.http.middlewares.traefik-auth.basicauth.users=admin:$$apr1$$yTyey7a2$$CDmIjg/aratMfqENIHcQW1"      - "traefik.http.routers.traefik.middlewares=traefik-auth"

traefik.yml

api:  dashboard: trueentryPoints:  http:    address: ":80"    http:      redirections:        entryPoint:          to: https          scheme: https          permanent: true  https:    address: ":443"  metrics:    address: ":8082"metrics:  prometheus:    entryPoint: metricsproviders:  docker:    endpoint: "unix:///var/run/docker.sock"    exposedByDefault: false  file:    directory: /custom    watch: truecertificatesResolvers:  letsEncrypt:    acme:      email: postmaster@example.com      storage: acme.json      #caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"      httpChallenge:        entryPoint: http

Viewing all articles
Browse latest Browse all 1501

Trending Articles