Global redirect www to non-www with HTTPS redirection

Good day,
I have applied a global HTTP -> HTTPS redirection using this this approach and it works fine. Additionally, I would like to add global www -> non-www redirection, which gets applied to any route.

This my static configuration:

# static configuration
[entryPoints]
   [entryPoints.web]
      address = ":80"

   [entryPoints.web-secure]
      address = ":443"

I have added additional router, middleware and noop service, so my configuration looks like this:

# dynamic configuration
[http.routers]
   [http.routers.redirect-to-https]
      entryPoints = ["web"]
      middlewares = ["https-redirect"]
      rule = "HostRegexp(`{host:.+}`)"
      service = "noop"

   [http.routers.redirect-to-nonwww]
      entryPoints = ["web-secure"]
      middlewares = ["nonwww-redirect"]
      rule = "HostRegexp(`{host:(www.+)}`)"
      service = "noop2"

[http.middlewares]
   [http.middlewares.https-redirect.redirectScheme]
      scheme = "https"
      permanent = true

   [http.middlewares.nonwww-redirect.redirectRegex]
      regex = "^https://www.(.*)"
      replacement = "https://$1"
      permanent = true

[http.services]
  [http.services.noop.loadBalancer]
    [[http.services.noop.loadBalancer.servers]]
      url = "http://192.168.0.1"

   [http.services.noop2.loadBalancer]
    [[http.services.noop2.loadBalancer.servers]]
      url = "http://192.168.0.2"

If I try this configuration, the the www -> non-www redirection does not work. However, if I try to apply the redirect middleware directly within a Docker service:

whoami:
    image: containous/whoami
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.entrypoints=web-secure"
      - "traefik.http.routers.whoami.rule=HostRegexp(`{host:(www.)?example.com}`)"
      - "traefik.http.routers.whoami.tls.certResolver=web"
      - "traefik.http.routers.whoami.middlewares=nonwww-redirect@file"

it does work. But still, this approach is not global.
First thing that occurred to me is the fact that the redirect-to-nonwww router gets a lower priority than any other application router because its rule is simply shorter. I tried setting the priority:

 [http.routers.redirect-to-nonwww]
      entryPoints = ["web-secure"]
      middlewares = ["nonwww-redirect"]
      rule = "HostRegexp(`{host:(www.+)}`)"
      service = "noop2"
      priority = 100

but with no success.
Is there a chance to apply both HTTPS redirection and www -> non-www redirection globally?
Thank you!

Hey @Dandry,
any news on this. Do you have a working global redirect you could share?

@Dan42 hi, no.
I still plug in the redirect middleware explicitly to every service I want the redirect for. Still hoping for someone from the dev team shedding some light here.