Traefik and Nomad Integration gives 502 bad gateway error

I am following this blog " Traefik Proxy Now Fully Integrates with Hashicorp Nomad", where things are mostly working for me, but at the end I got 502 bad gateway error. Here's my job config:

job "traefik" {
  datacenters = ["dc1"]
  type        = "service"

  group "traefik" {
    count = 1

    network {
      port  "http"{
         static = 80
      }
      port  "admin"{
         static = 8080
      }
    }

    service {
      name = "traefik-http"
      provider = "nomad"
      port = "http"
    }

    task "traefik" {
      driver = "docker"
      config {
        image = "traefik:latest"
        ports = ["admin", "http"]
        args = [
          "--api.dashboard=true",
          "--api.insecure=true", ### For Test only, please do not use that in production
          "--entrypoints.http.address=:${NOMAD_PORT_http}",
          "--entrypoints.traefik.address=:${NOMAD_PORT_admin}",
          "--providers.nomad=true",
          "--providers.nomad.endpoint.address=http://host.docker.internal:4646" ### IP to your nomad server 
        ]
      }
    }
  }
}

and

job "whoami" {
  datacenters = ["dc1"]

  type = "service"

  group "demo" {
    count = 1

    network {
       port "http" {
         to = 80
       }
    }

    service {
      name = "whoami-demo"
      port = "http"
      provider = "nomad"

      tags = [
        "traefik.enable=true",
        "traefik.http.routers.http.rule=Path(`/whoami`)",
      ]
    }

    task "server" {
      env {
        WHOAMI_PORT_NUMBER = "${NOMAD_PORT_http}"
      }

      driver = "docker"

      config {
        image = "traefik/whoami"
        ports = ["http"]
      }
    }
  }
}

The routers and services all show up in the traefik dashboard, and i can access the whoami service at the actual port, e.g. http://127.0.0.1:20218/, but when i tried to get to it using the router, e.g. http://127.0.0.1/whoami, i got 502 bad gateway. Can someone shed some time?

I have the same problem, I've been trying to figure out how to fix it for a few days now.
I understand that 127.0.0.1 inside of the traefik container is a different localhost compared to the localhost outside of it, however I havent figured out how to make traefik bind the service to the outside ip (my eth0 in my case).

I tried changing the --bind address of nomad but it didn't seem to make a difference.

Does this announcement / tutorial assume some specific configuration for nomad? Working with -dev mode here.

Any help would be great! For now I will try to add consul to the mix sadly..