Hi,
I am trying to configure traefik for HTTP only traffic. I deployed traefik inside swarm cluster with following config:
version: '3.9'
services:
traefik:
image: traefik:v2.9
ports:
- 80:80
- 8080:8080
deploy:
placement:
constraints:
- node.role==manager
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
command:
- --providers.docker
- --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik`)
- --providers.docker.exposedbydefault=false
- --providers.docker.swarmMode=true
- --providers.docker.endpoint=unix:///var/run/docker.sock
- --entrypoints.http.address=:80
- --entrypoints.http.http.tls=false
- --accesslog
- --log
- --api.insecure=true
- --log.level=DEBUG
networks:
- traefik
networks:
traefik:
external: true
Then, I added labels to my app:
labels:
- traefik.http.routers.app.rule=Host(`my_app.domain.com`)
- traefik.http.routers.app.tls=false
- traefik.http.services.app.loadbalancer.server.port=80
- traefik.enable=true
- traefik.constraint-label=traefik
But when I tried to access app via http://my_app.domain.com I got redirected to https://my_app.domain.com
In logs I found this:
"Adding route for my_app.domain.com with TLS options default" entryPointName=http
and
level=debug msg="Configuration received: {\"http\":{\"routers\":{\"app\":{\"service\":\"app\",\"rule\":\"Host(`my_app.domain.com`)\"}},\"services\":{\"app\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://10.0.7.131:80\"}],\"passHostHeader\":true}}}},\"tcp\":{},\"udp\":{}}" providerName=docker
level=debug msg="No default certificate, fallback to the internal generated certificate" tlsStoreName=default
level=debug msg="Added outgoing tracing middleware api@internal" routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik
level=debug msg="Added outgoing tracing middleware dashboard@internal" middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik routerName=dashboard@internal
level=debug msg="Creating middleware" middlewareType=StripPrefix entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
level=debug msg="Creating middleware" middlewareType=RedirectRegex entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
level=debug msg="Setting up redirection from ^(http:\\/\\/(\\[[\\w:.]+\\]|[\\w\\._-]+)(:\\d+)?)\\/$ to ${1}/dashboard/" routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=traefik
level=debug msg="No entryPoint defined for this router, using the default one(s) instead: [http]" routerName=app
level=debug msg="No default certificate, fallback to the internal generated certificate" tlsStoreName=default
level=debug msg="Creating middleware" routerName=app@docker entryPointName=http serviceName=app middlewareType=Pipelining middlewareName=pipelining
level=debug msg="Creating load-balancer" routerName=app@docker entryPointName=http serviceName=app
level=debug msg="Creating server 0 http://10.0.7.131:80" routerName=app@docker entryPointName=http serviceName=app serverName=0
level=debug msg="child http://10.0.7.131:80 now UP"
level=debug msg="Propagating new UP status"
level=debug msg="Added outgoing tracing middleware app" entryPointName=http routerName=app@docker middlewareName=tracing middlewareType=TracingForwarder
level=debug msg="Creating middleware" middlewareType=Recovery entryPointName=http middlewareName=traefik-internal-recovery
level=debug msg="Added outgoing tracing middleware dashboard@internal" entryPointName=traefik routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder
level=debug msg="Creating middleware" routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix entryPointName=traefik
level=debug msg="Adding tracing to middleware" routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal entryPointName=traefik
level=debug msg="Creating middleware" routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
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
level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
level=debug msg="Added outgoing tracing middleware api@internal" entryPointName=traefik routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder
level=debug msg="Creating middleware" entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
How to change that's behaviour?
Thanks.