Read and use request's custom header variable

Is there a way I can set the backend with http_my_custom_header ?


could you elaborate a bit what do you try to do?

There are several backends named env1, env2, env3, and a frontends like this:

    "frontends": {
        "a": {
            "backend": $http_entranceEnv,
            "routes": {
                "host": {
                    "rule": ""
                "path": {
                    "rule": "PathPrefix:/api"
                "env": {
                    "rule": "Headers:entranceEnv,$http_entranceEnv"

Maybe what I am want to do is:
If I requested with HTTP header "entranceEnv" valued env1, env2, env3, then I can access to corresponding backend server.

Which provider are you using?
Which traefik version are you using?

provider: zookeeper
Version: 1.7.12