Hello there, I have a problem with my traefik configuration for the https redirection :
(https work but when I request the http port, I receive 404 Error.
What did you expect to see?
I want to see the JSON of my web API :
{
"_links": {
"self": {
"href": "http://archi-data.nocturlab.fr/profile"
},
"groups": {
"href": "http://archi-data.nocturlab.fr/profile/groups"
},
"texts": {
"href": "http://archi-data.nocturlab.fr/profile/texts"
},
"languages": {
"href": "http://archi-data.nocturlab.fr/profile/languages"
},
"translations": {
"href": "http://archi-data.nocturlab.fr/profile/translations"
},
"users": {
"href": "http://archi-data.nocturlab.fr/profile/users"
},
"accesses": {
"href": "http://archi-data.nocturlab.fr/profile/accesses"
}
}
}
What did you see instead?
I see the Traefik v2 404 error message :
404 page not found
Output of traefik version: (What version of Traefik are you using?)
/srv/stacks : docker exec -it 43dc32702fd9 traefik version
Version: 2.0.1
Codename: montdor
Go version: go1.13.1
Built: 2019-09-26T16:18:03Z
OS/Arch: linux/amd64
What is your environment & configuration (arguments, toml, provider, platform, ...)?
version: "3.7"
services:
ingress:
image: traefik:v2.0
networks:
- traefik-net
ports:
- "80:80"
- "443:443"
command:
### ###
# Traefik Global Configuration #
### ###
# Enable DEBUG logs
- "--log.level=INFO"
# Enable api access without authentification (only GET route so it only possible to get IPs)
- "--api.insecure=true"
# Set the provider to Docker
- "--providers.docker=true"
# Set the docker network
- "--providers.docker.network=traefik-net"
# Set to docker swarm cluster
- "--providers.docker.swarmMode=true"
# If False : Do not expose containers to the web by default
- "--providers.docker.exposedbydefault=false"
# Default rule to service-name.nocturlab.fr
- "--providers.docker.defaultRule=Host(`{{ trimPrefix `/` .Name }}.nocturlab.fr`)"
# Default http port
- "--entrypoints.http.address=:80"
# Default https port
- "--entrypoints.https.address=:443"
# Enable let's encrypt
- "--certificatesresolvers.certbot.acme.httpchallenge=true"
- "--certificatesresolvers.certbot.acme.httpchallenge.entrypoint=http"
- "--certificatesresolvers.certbot.acme.email=admin@nocturlab.fr"
- "--certificatesresolvers.certbot.acme.storage=/letsencrypt/acme.json"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./acme.json:/letsencrypt/acme.json
deploy:
replicas: 1
labels:
### ###
# Traefik Dashboard #
### ###
# Enable this endpoint
- traefik.enable=true
# Set the service route
- traefik.http.routers.ingress.rule=Host(`panel.nocturlab.fr`)
# Set the service port
- traefik.http.services.ingress.loadbalancer.server.port=8080
# Set the entrypoint (http & https)
- traefik.http.routers.ingress.entrypoints=http,https
# Enable Let's encrypt auto certificat creation
- traefik.http.routers.ingress.tls.certresolver=certbot
# Rule to redirect to http to https
- traefik.http.middlewares.ingress-https-redirect.redirectscheme.scheme=https
# Enable authentification and https
- traefik.http.routers.ingress.middlewares=ingress-https-redirect@docker,ingress-auth@docker
# Uncommant this to enable basic authentification
- traefik.http.middlewares.ingress-auth.basicauth.users=admin:**{{my_password}}**
placement:
constraints: [node.hostname == nocturlab-vps]
networks:
traefik-net:
external: true
My provider is docker (swarm mode enabled)
If applicable, please paste the log output in DEBUG level (--log.level=DEBUG switch)
/srv/stacks : docker logs 43dc32702fd9 -f
time="2019-09-27T12:30:31Z" level=info msg="Configuration loaded from flags."
time="2019-09-27T12:30:31Z" level=info msg="Traefik version 2.0.1 built on 2019-09-26T16:18:03Z"
time="2019-09-27T12:30:31Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v2.0/contributing/data-collection/\n"
time="2019-09-27T12:30:32Z" level=info msg="Starting provider aggregator.ProviderAggregator {}"
time="2019-09-27T12:30:32Z" level=info msg="Starting provider *acme.Provider {\"email\":\"admin@nocturlab.fr\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/letsencrypt/acme.json\",\"keyType\":\"RSA4096\",\"httpChallenge\":{\"entryPoint\":\"http\"},\"ResolverName\":\"certbot\",\"store\":{},\"ChallengeStore\":{}}"
time="2019-09-27T12:30:32Z" level=info msg="Testing certificate renew..." providerName=certbot.acme
time="2019-09-27T12:30:32Z" level=info msg="Starting provider *docker.Provider {\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmMode\":true,\"network\":\"traefik-net\",\"swarmModeRefreshSeconds\":15000000000}"
Thank you for your help