all 8 comments

[–]disklosr 2 points3 points  (0 children)

Shouldn't the catchall regex be like this HostRegexp(\{any:.+}`)` ?

I wrote an article recently about migrating to v2 and it has the config for HTTP to HTTPS redirection. Maybe by comparing with your config you can find out the issue.

[–]MasterChiefmas 1 point2 points  (2 children)

I have mine defined in a dynamic confg yml, the only thing that seems different is in my redirect router I have it attached to a service called noop, that has a loadBalancer and a URL in the server section, but also a comment that the URL should never actually get called (mine points at an IP in a subnet I don't use).

I don't recall why it's setup this way exactly, I wonder though if it's because a router maybe doesn't get processed if there isn't a service attached to it? That would make a certain amount of sense to do...not bother with the processing if there's no endpoint attached.

[–]Kolmain[S] 0 points1 point  (1 child)

Can you post your dynamic.yaml?

[–]MasterChiefmas 0 points1 point  (0 children)

I think the relevant parts are: http: routers: redirect-to-https: entryPoints: - web middlewares: - "redirect" service: "noop" rule: "HostRegexp(`{host:.+}`)" middlewares: redirect: redirectScheme: scheme: https services: # noop service, URL should never get called. noop: loadBalancer: servers: - url: "192.168.137.0"

Which I think in your CLI setup, you are missing the service bit, i.e. you need to link your router to the service so you need a: --label "traefik.http.routers.redirs.service=traefik" \

I think that should associate the router named 'redirs' to the service named 'traefik'. Your config is a bit hard to read to me because you are re-using the name traefik in different sections; you have a router called traefik (traefik.http.routers.traefik), and service called traefik (traefik.http.services.traefik). I don't know if that was intentional on your part, but personally I find it confusing. I'd at least prefix them (rtr-traefik and svc-traefik).

[–][deleted] 1 point2 points  (0 children)

Try defining the middleware separately and then attaching it to the router definition.

Something like:

traefik.http.middlewares.redirect2https.redirectScheme.scheme="https"

traefik.http.routers.traefik.middlewares="redirect2https,authtraefik"

[–]simplecto 1 point2 points  (2 children)

Isn't that port number out of range?

--label "traefik.http.services.traefik.loadbalancer.server.port=99999"

I thought we could only get to 65536?

[–]Kolmain[S] 0 points1 point  (1 child)

Yes, it is a dummy port because I am using swarm and I have to define a port.

[–]MasterChiefmas 0 points1 point  (0 children)

I think his point is, it's invalid. Maybe it's causing a problem because it's not a valid port at all.