1
0
Fork 0

New rule syntax

Co-authored-by: jbdoumenjou <jb.doumenjou@gmail.com>
This commit is contained in:
SALLEYRON Julien 2019-01-30 16:24:07 +01:00 committed by Traefiker Bot
parent 7155f0d50d
commit 9ebe3c38b2
89 changed files with 1111 additions and 1357 deletions

View file

@ -45,7 +45,7 @@ func (s *DockerComposeSuite) TestComposeScale(c *check.C) {
DefaultRule string
}{
DockerHost: s.getDockerHost(),
DefaultRule: "Host:{{ normalize .Name }}.docker.localhost",
DefaultRule: "Host(`{{ normalize .Name }}.docker.localhost`)",
}
file := s.adaptFile(c, "fixtures/docker/minimal.toml", tempObjects)
defer os.Remove(file)

View file

@ -88,7 +88,7 @@ func (s *DockerSuite) TestSimpleConfiguration(c *check.C) {
DefaultRule string
}{
DockerHost: s.getDockerHost(),
DefaultRule: "Host:{{ normalize .Name }}.docker.localhost",
DefaultRule: "Host(`{{ normalize .Name }}.docker.localhost`)",
}
file := s.adaptFile(c, "fixtures/docker/simple.toml", tempObjects)
@ -112,7 +112,7 @@ func (s *DockerSuite) TestDefaultDockerContainers(c *check.C) {
DefaultRule string
}{
DockerHost: s.getDockerHost(),
DefaultRule: "Host:{{ normalize .Name }}.docker.localhost",
DefaultRule: "Host(`{{ normalize .Name }}.docker.localhost`)",
}
file := s.adaptFile(c, "fixtures/docker/simple.toml", tempObjects)
@ -150,7 +150,7 @@ func (s *DockerSuite) TestDockerContainersWithLabels(c *check.C) {
DefaultRule string
}{
DockerHost: s.getDockerHost(),
DefaultRule: "Host:{{ normalize .Name }}.docker.localhost",
DefaultRule: "Host(`{{ normalize .Name }}.docker.localhost`)",
}
file := s.adaptFile(c, "fixtures/docker/simple.toml", tempObjects)
@ -158,13 +158,13 @@ func (s *DockerSuite) TestDockerContainersWithLabels(c *check.C) {
// Start a container with some labels
labels := map[string]string{
"traefik.Routers.Super.Rule": "Host:my.super.host",
"traefik.Routers.Super.Rule": "Host(`my.super.host`)",
}
s.startContainerWithLabels(c, "swarm:1.0.0", labels, "manage", "token://blabla")
// Start another container by replacing a '.' by a '-'
labels = map[string]string{
"traefik.Routers.SuperHost.Rule": "Host:my-super.host",
"traefik.Routers.SuperHost.Rule": "Host(`my-super.host`)",
}
s.startContainerWithLabels(c, "swarm:1.0.0", labels, "manage", "token://blablabla")
@ -206,7 +206,7 @@ func (s *DockerSuite) TestDockerContainersWithOneMissingLabels(c *check.C) {
DefaultRule string
}{
DockerHost: s.getDockerHost(),
DefaultRule: "Host:{{ normalize .Name }}.docker.localhost",
DefaultRule: "Host(`{{ normalize .Name }}.docker.localhost`)",
}
file := s.adaptFile(c, "fixtures/docker/simple.toml", tempObjects)
@ -242,7 +242,7 @@ func (s *DockerSuite) TestRestartDockerContainers(c *check.C) {
DefaultRule string
}{
DockerHost: s.getDockerHost(),
DefaultRule: "Host:{{ normalize .Name }}.docker.localhost",
DefaultRule: "Host(`{{ normalize .Name }}.docker.localhost`)",
}
file := s.adaptFile(c, "fixtures/docker/simple.toml", tempObjects)
@ -250,7 +250,7 @@ func (s *DockerSuite) TestRestartDockerContainers(c *check.C) {
// Start a container with some labels
labels := map[string]string{
"traefik.Routers.Super.Rule": "Host:my.super.host",
"traefik.Routers.Super.Rule": "Host(`my.super.host`)",
"traefik.Services.powpow.LoadBalancer.server.Port": "2375",
}
s.startContainerWithNameAndLabels(c, "powpow", "swarm:1.0.0", labels, "manage", "token://blabla")

View file

@ -25,5 +25,5 @@ checkNewVersion = false
[providers]
[providers.docker]
exposedByDefault = false
defaultRule = "{{ normalize .Name }}.docker.local"
defaultRule = "Host(`{{ normalize .Name }}.docker.local`)"
watch = true

View file

@ -51,5 +51,5 @@ logLevel = "DEBUG"
[routers]
[routers.test]
service = "test"
rule = "Host:traefik.acme.wtf"
rule = "Host(`traefik.acme.wtf`)"
entryPoints = ["https"]

View file

@ -48,5 +48,5 @@ path="/traefik"
[routers]
[routers.test]
service = "test"
rule = "Host:traefik.acme.wtf"
rule = "Host(`traefik.acme.wtf`)"
entryPoints = ["https"]

View file

@ -52,5 +52,5 @@ logLevel = "DEBUG"
[routers]
[routers.test]
service = "test"
rule = "Host:traefik.acme.wtf"
rule = "Host(`traefik.acme.wtf`)"
entryPoints = ["https"]

View file

@ -7,7 +7,7 @@
[routers]
[routers.test]
service = "test"
rule = "Host:traefik.acme.wtf"
rule = "Host(`traefik.acme.wtf`)"
entryPoints = ["https"]

View file

@ -10,4 +10,4 @@ logLevel = "DEBUG"
[providers]
[providers.consulCatalog]
domain = "consul.localhost"
frontEndRule = "Host:{{.ServiceName}}.{{.Domain}}"
frontEndRule = "Host(`{{.ServiceName}}.{{.Domain}}`)"

View file

@ -10,7 +10,7 @@ logLevel = "DEBUG"
[routers]
[routers.router1]
rule = "Host:test.local"
Rule = "Host(`test.local`)"
service = "service1"
middlewares = ["error"]

View file

@ -10,7 +10,7 @@ logLevel = "DEBUG"
[routers]
[routers.router1]
rule = "Host:test.local"
Rule = "Host(`test.local`)"
service = "service1"
middlewares = ["error"]

View file

@ -1,6 +1,6 @@
[routers]
[routers.router1]
rule = "Path:/test1"
rule = "Path(`/test1`)"
service = "service1"
[services]

View file

@ -1,6 +1,6 @@
[routers]
[routers.router2]
rule = "Path:/test2"
rule = "Path(`/test2`)"
service = "service2"
[services]

View file

@ -11,11 +11,11 @@ logLevel = "DEBUG"
[routers]
[routers.router1]
rule = "Host:test.localhost"
rule = "Host(`test.localhost`)"
service = "service2"
[routers.router2]
rule = "Path:/test"
rule = "Path(`/test`)"
middlewares = ["circuitbreaker"]
service = "service1"

View file

@ -19,7 +19,7 @@ debug = true
[routers]
[routers.router1]
rule = "Host:127.0.0.1"
rule = "Host(`127.0.0.1`)"
service = "service1"
[services]

View file

@ -13,7 +13,7 @@ debug = true
[routers]
[routers.router1]
rule = "Host:127.0.0.1"
rule = "Host(`127.0.0.1`)"
service = "service1"
[services]

View file

@ -17,7 +17,7 @@ debug = true
[routers]
[routers.router1]
rule = "Host:127.0.0.1"
rule = "Host(`127.0.0.1`)"
service = "service1"
[services]

View file

@ -21,7 +21,7 @@ debug = true
[routers]
[routers.router1]
rule = "Host:127.0.0.1"
rule = "Host(`127.0.0.1`)"
service = "service1"

View file

@ -18,7 +18,7 @@ rootCAs = [ """{{ .CertContent }}""" ]
[routers]
[routers.router1]
rule = "Host:127.0.0.1"
rule = "Host(`127.0.0.1`)"
service = "service1"
[services]

View file

@ -15,7 +15,7 @@ logLevel = "DEBUG"
[routers]
[routers.router1]
service = "service1"
rule = "Host:test.localhost"
Rule = "Host(`test.localhost`)"
[services]
[services.service1.loadbalancer]

View file

@ -15,7 +15,7 @@ logLevel = "DEBUG"
[routers]
[routers.router1]
service = "service1"
rule = "Host:test.localhost"
Rule = "Host(`test.localhost`)"
[services]
[services.service1.loadbalancer]

View file

@ -13,7 +13,7 @@ logLevel = "DEBUG"
[routers]
[routers.router1]
service = "service1"
rule = "Host:test.localhost"
Rule = "Host(`test.localhost`)"
[services]
[services.service1.loadbalancer]

View file

@ -13,7 +13,7 @@ logLevel = "DEBUG"
[routers]
[routers.router1]
service = "service1"
rule = "Host:test.localhost"
Rule = "Host(`test.localhost`)"
[services]
[services.service1.loadbalancer]

View file

@ -17,10 +17,10 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Routers.router2]
Service = "service2"
Rule = "Host:snitest.org"
Rule = "Host(`snitest.org`)"
[Services]
[Services.service1]

View file

@ -16,10 +16,10 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Routers.router2]
Service = "service2"
Rule = "Host:snitest.org"
Rule = "Host(`snitest.org`)"
[Services]
[Services.service1]

View file

@ -18,10 +18,10 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Routers.router2]
Service = "service2"
Rule = "Host:snitest.org"
Rule = "Host(`snitest.org`)"
[Services]
[Services.service1]

View file

@ -1,10 +1,10 @@
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Routers.router2]
Service = "service2"
Rule = "Host:snitest.org"
Rule = "Host(`snitest.org`)"
[Services]
[Services.service1]

View file

@ -17,10 +17,10 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Routers.router2]
Service = "service1"
Rule = "Host:www.snitest.com"
Rule = "Host(`www.snitest.com`)"
[Services]
[Services.service1]

View file

@ -19,52 +19,52 @@ logLevel = "DEBUG"
[Routers.router1]
Service = "service1"
Middlewares = ["redirect-https"]
Rule = "Host: example.com"
Rule = "Host(`example.com`)"
[Routers.router2]
Service = "service1"
Middlewares = ["redirect-https", "api-slash-strip"]
Rule = "Host: example2.com"
Rule = "Host(`example2.com`)"
[Routers.router3]
Service = "service1"
Middlewares = ["redirect-https", "foo-add-prefix"]
Rule = "Host: test.com"
Rule = "Host(`test.com`)"
[Routers.router4]
Service = "service1"
Middlewares = ["redirect-https", "foo-slash-add-prefix"]
Rule = "Host: test2.com"
Rule = "Host(`test2.com`)"
[Routers.router5]
Service = "service1"
Middlewares = ["redirect-https", "id-strip-regex-prefix"]
Rule = "Host: foo.com"
Rule = "Host(`foo.com`)"
[Routers.router6]
Service = "service1"
Middlewares = ["redirect-https", "id-slash-strip-regex-prefix"]
Rule = "Host: foo2.com"
Rule = "Host(`foo2.com`)"
[Routers.router7]
Service = "service1"
Middlewares = ["redirect-https", "api-regex-replace"]
Rule = "Host: bar.com"
Rule = "Host(`bar.com`)"
[Routers.router8]
Service = "service1"
Middlewares = ["redirect-https", "api-slash-regex-replace"]
Rule = "Host: bar2.com"
Rule = "Host(`bar2.com`)"
[Routers.router9]
Service = "service1"
Middlewares = ["redirect-https", "api-replace-path"]
Rule = "Host: pow.com"
Rule = "Host(`pow.com`)"
[Routers.router10]
Service = "service1"
Middlewares = ["redirect-https", "api-slash-replace-path"]
Rule = "Host: pow2.com"
Rule = "Host(`pow2.com`)"
[Middlewares]
[Middlewares.api-strip.StripPrefix]

View file

@ -15,10 +15,10 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Routers.router2]
Service = "service2"
Rule = "Host:snitest.org"
Rule = "Host(`snitest.org`)"
[Services]
[Services.service1]

View file

@ -16,10 +16,10 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
rule = "HostRegexp: {subdomain:[a-z1-9-]+}.snitest.com"
rule = "HostRegexp(`{subdomain:[a-z1-9-]+}.snitest.com`)"
[Routers.router2]
Service = "service1"
rule = "HostRegexp: {subdomain:[a-z1-9-]+}.www.snitest.com"
rule = "HostRegexp(`{subdomain:[a-z1-9-]+}.www.snitest.com`)"
[Services]
[Services.service1]

View file

@ -18,10 +18,10 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Routers.router2]
Service = "service1"
Rule = "Host:www.snitest.com"
Rule = "Host(`www.snitest.com`)"
[Services]
[Services.service1]

View file

@ -19,7 +19,7 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Host:snitest.com"
Rule = "Host(`snitest.com`)"
[Services]
[Services.service1]

View file

@ -33,7 +33,7 @@ fblo6RBxUQ==
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Path: /ping"
Rule = "Path(`/ping`)"
[Services]
[Services.service1]

View file

@ -17,7 +17,7 @@ rootCAs = [ "fixtures/https/rootcas/local.crt"]
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Path: /ping"
Rule = "Path(`/ping`)"
[Services]
[Services.service1]

View file

@ -22,4 +22,4 @@ logLevel = "DEBUG"
[frontends.frontend1]
backend = "backend1"
[frontends.frontend1.routes.test_1]
rule = "Path:/test/foo"
rule = "Path(`/test/foo`)"

View file

@ -34,7 +34,7 @@ entryPoint = "api"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Path: /test1"
Rule = "Path(`/test1`)"
[Services]
[Services.service1]

View file

@ -18,7 +18,7 @@ debug=true
[Routers]
[Routers.router-1]
Service = "service-test"
Rule = "PathPrefix:/file"
Rule = "PathPrefix(`/file`)"
[Services]
[Services.service-test]

View file

@ -15,7 +15,7 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Path:/whoami"
Rule = "Path(`/whoami`)"
[Services]
[Services.service1]

View file

@ -15,7 +15,7 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Path:/whoami"
Rule = "Path(`/whoami`)"
[Services]
[Services.service1]

View file

@ -12,7 +12,7 @@ logLevel = "DEBUG"
[Routers.router1]
Service = "service1"
Middlewares = [ "ratelimit" ]
Rule = "Path:/"
Rule = "Path(`/`)"
[Middlewares]
[Middlewares.ratelimit.RateLimit]

View file

@ -20,7 +20,7 @@ logLevel = "DEBUG"
[Routers]
[Routers.router]
Service = "service"
Rule = "Path:/service"
Rule = "Path(`/service`)"
[Services]
[Services.service]

View file

@ -14,7 +14,7 @@ logLevel = "DEBUG"
[Routers.router1]
Service = "service1"
Middlewares = [ "retry" ]
Rule = "PathPrefix:/"
Rule = "PathPrefix(`/`)"
[Middlewares.retry.Retry]
Attempts = 3

View file

@ -10,7 +10,7 @@ logLevel = "DEBUG"
[providers]
[providers.docker]
exposedByDefault = false
defaultRule = "{{ normalize .Name }}.docker.local"
defaultRule = "Host(`{{ normalize .Name }}.docker.local`)"
watch = true
[hostResolver]

View file

@ -14,12 +14,12 @@ debug=true
[Routers.router1]
EntryPoints = ["http"]
Service = "service1"
Rule = "PathPrefix:/whoami"
Rule = "PathPrefix(`/whoami`)"
[Routers.router2]
EntryPoints = ["traefik"]
Service = "service2"
Rule = "PathPrefix:/whoami"
Rule = "PathPrefix(`/whoami`)"
[Services]
[Services.service1]

View file

@ -23,11 +23,11 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Path:/dialTimeout"
Rule = "Path(`/dialTimeout`)"
[Routers.router2]
Service = "service2"
Rule = "Path:/responseHeaderTimeout"
Rule = "Path(`/responseHeaderTimeout`)"
[Services]
[Services.service1]

View file

@ -27,15 +27,15 @@ debug = true
[Routers.router1]
Service = "service1"
Middlewares = ["retry", "ratelimit"]
Rule = "Path:/ratelimit"
Rule = "Path(`/ratelimit`)"
[Routers.router2]
Service = "service2"
Middlewares = ["retry"]
Rule = "Path:/retry"
Rule = "Path(`/retry`)"
[Routers.router3]
Service = "service3"
Middlewares = ["retry", "basic-auth"]
Rule = "Path:/auth"
Rule = "Path(`/auth`)"
[Middlewares]
[Middlewares.retry.retry]

View file

@ -21,5 +21,5 @@ checkNewVersion = false
[providers]
[providers.docker]
exposedByDefault = false
defaultRule = "{{ normalize .Name }}.docker.local"
defaultRule = "Host(`{{ normalize .Name }}.docker.local`)"
watch = true

View file

@ -13,7 +13,7 @@ logLevel = "DEBUG"
[Routers]
[Routers.router1]
Service = "service1"
Rule = "PathPrefix:/ws"
Rule = "PathPrefix(`/ws`)"
[Services]
[Services.service1]

View file

@ -21,7 +21,7 @@ insecureSkipVerify=true
[Routers]
[Routers.router1]
Service = "service1"
Rule = "Path:/echo,/ws"
Rule = "Path(`/echo`,`/ws`)"
[Services]
[Services.service1]

View file

@ -167,7 +167,7 @@ func (s *GRPCSuite) TestGRPC(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:127.0.0.1"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`127.0.0.1`)"))
c.Assert(err, check.IsNil)
var response string
@ -205,7 +205,7 @@ func (s *GRPCSuite) TestGRPCh2c(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:127.0.0.1"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`127.0.0.1`)"))
c.Assert(err, check.IsNil)
var response string
@ -247,7 +247,7 @@ func (s *GRPCSuite) TestGRPCh2cTermination(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:127.0.0.1"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`127.0.0.1`)"))
c.Assert(err, check.IsNil)
var response string
@ -289,7 +289,7 @@ func (s *GRPCSuite) TestGRPCInsecure(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:127.0.0.1"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`127.0.0.1`)"))
c.Assert(err, check.IsNil)
var response string
@ -336,7 +336,7 @@ func (s *GRPCSuite) TestGRPCBuffer(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:127.0.0.1"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`127.0.0.1`)"))
c.Assert(err, check.IsNil)
var client helloworld.Greeter_StreamExampleClient
client, closer, err := callStreamExampleClientGRPC()
@ -396,7 +396,7 @@ func (s *GRPCSuite) TestGRPCBufferWithFlushInterval(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:127.0.0.1"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`127.0.0.1`)"))
c.Assert(err, check.IsNil)
var client helloworld.Greeter_StreamExampleClient

View file

@ -41,7 +41,7 @@ func (s *HealthCheckSuite) TestSimpleConfiguration(c *check.C) {
defer cmd.Process.Kill()
// wait for traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("Host:test.localhost"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("Host(`test.localhost`)"))
c.Assert(err, checker.IsNil)
frontendHealthReq, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/health", nil)
@ -117,7 +117,7 @@ func (s *HealthCheckSuite) doTestMultipleEntrypoints(c *check.C, fixture string)
defer cmd.Process.Kill()
// Wait for traefik
err = try.GetRequest("http://localhost:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("Host:test.localhost"))
err = try.GetRequest("http://localhost:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("Host(`test.localhost`)"))
c.Assert(err, checker.IsNil)
// Check entrypoint http1
@ -194,7 +194,7 @@ func (s *HealthCheckSuite) TestPortOverload(c *check.C) {
defer cmd.Process.Kill()
// wait for traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 10*time.Second, try.BodyContains("Host:test.localhost"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 10*time.Second, try.BodyContains("Host(`test.localhost`)"))
c.Assert(err, checker.IsNil)
frontendHealthReq, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/health", nil)

View file

@ -32,7 +32,7 @@ func (s *HTTPSSuite) TestWithSNIConfigHandshake(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host:snitest.org"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host(`snitest.org`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -66,7 +66,7 @@ func (s *HTTPSSuite) TestWithSNIConfigRoute(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:snitest.org"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`snitest.org`)"))
c.Assert(err, checker.IsNil)
backend1 := startTestServer("9010", http.StatusNoContent)
@ -122,7 +122,7 @@ func (s *HTTPSSuite) TestWithSNIStrictNotMatchedRequest(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host:snitest.com"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host(`snitest.com`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -146,7 +146,7 @@ func (s *HTTPSSuite) TestWithDefaultCertificate(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host:snitest.com"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host(`snitest.com`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -180,7 +180,7 @@ func (s *HTTPSSuite) TestWithDefaultCertificateNoSNI(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host:snitest.com"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host(`snitest.com`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -214,7 +214,7 @@ func (s *HTTPSSuite) TestWithOverlappingStaticCertificate(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host:snitest.com"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host(`snitest.com`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -249,7 +249,7 @@ func (s *HTTPSSuite) TestWithOverlappingDynamicCertificate(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host:snitest.com"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host(`snitest.com`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -282,7 +282,7 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host:snitest.org"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("Host(`snitest.org`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -338,7 +338,7 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipeCAs(c *check.
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:snitest.org"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`snitest.org`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -399,7 +399,7 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipeCAsMultipleFi
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:snitest.org"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`snitest.org`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{
@ -544,7 +544,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithNoChange(c *check.C) {
}
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:"+tr1.TLSClientConfig.ServerName))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`"+tr1.TLSClientConfig.ServerName+"`)"))
c.Assert(err, checker.IsNil)
backend1 := startTestServer("9010", http.StatusNoContent)
@ -613,7 +613,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithChange(c *check.C) {
}
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:"+tr2.TLSClientConfig.ServerName))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`"+tr2.TLSClientConfig.ServerName+"`)"))
c.Assert(err, checker.IsNil)
backend1 := startTestServer("9010", http.StatusNoContent)
@ -676,7 +676,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithTlsConfigurationDeletion(c
}
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host:"+tr2.TLSClientConfig.ServerName))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 1*time.Second, try.BodyContains("Host(`"+tr2.TLSClientConfig.ServerName+"`)"))
c.Assert(err, checker.IsNil)
backend2 := startTestServer("9020", http.StatusResetContent)
@ -741,7 +741,7 @@ func (s *HTTPSSuite) TestEntrypointHttpsRedirectAndPathModification(c *check.C)
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 5*time.Second, try.BodyContains("Host: example.com"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 5*time.Second, try.BodyContains("Host(`example.com`)"))
c.Assert(err, checker.IsNil)
client := &http.Client{
@ -842,7 +842,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicCaseInsensitive(c *check.C) {
defer cmd.Process.Kill()
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("HostRegexp: {subdomain:[a-z1-9-]+}.www.snitest.com"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 500*time.Millisecond, try.BodyContains("HostRegexp(`{subdomain:[a-z1-9-]+}.www.snitest.com`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{

View file

@ -97,7 +97,7 @@ func (s *MarathonSuite15) TestConfigurationUpdate(c *check.C) {
CPU(0.1).
Memory(32).
EmptyNetworks().
AddLabel("traefik.Routers.rt.Rule", "PathPrefix:/service")
AddLabel("traefik.Routers.rt.Rule", "PathPrefix(`/service`)")
app.Container.
Expose(80).
Docker.
@ -117,7 +117,7 @@ func (s *MarathonSuite15) TestConfigurationUpdate(c *check.C) {
CPU(0.1).
Memory(32).
EmptyNetworks().
AddLabel("traefik.Routers.app.Rule", "PathPrefix:/app")
AddLabel("traefik.Routers.app.Rule", "PathPrefix(`/app`)")
app.Container.
Expose(80).
Docker.

View file

@ -108,7 +108,7 @@ func (s *MarathonSuite) TestConfigurationUpdate(c *check.C) {
Name("/whoami").
CPU(0.1).
Memory(32).
AddLabel("traefik.Routers.rt.Rule", "PathPrefix:/service")
AddLabel("traefik.Routers.rt.Rule", "PathPrefix(`/service`)")
app.Container.Docker.Bridged().
Expose(80).
Container("containous/whoami")
@ -125,7 +125,7 @@ func (s *MarathonSuite) TestConfigurationUpdate(c *check.C) {
Name("/whoami").
CPU(0.1).
Memory(32).
AddLabel("traefik.Routers.app.Rule", "PathPrefix:/app")
AddLabel("traefik.Routers.app.Rule", "PathPrefix(`/app`)")
app.Container.Docker.Bridged().
Expose(80).
Container("containous/whoami")

View file

@ -3,21 +3,21 @@ server0:
labels:
- traefik.enable=true
- traefik.routers.rt-server0.entryPoints=http
- traefik.routers.rt-server0.rule=Path:/test
- traefik.routers.rt-server0.rule=Path("/test")
- traefik.services.service1.loadbalancer.server.port=80
server1:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.routers.rt-server1.entryPoints=http
- traefik.routers.rt-server1.rule=Host:frontend1.docker.local
- traefik.routers.rt-server1.rule=Host("frontend1.docker.local")
- traefik.services.service1.loadbalancer.server.port=80
server2:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.routers.rt-server2.entryPoints=http
- traefik.routers.rt-server2.rule=Host:frontend2.docker.local
- traefik.routers.rt-server2.rule=Host("frontend2.docker.local")
- traefik.services.service2.loadbalancer.server.port=80
- traefik.services.service2.loadbalancer.method=drr
server3:
@ -25,7 +25,7 @@ server3:
labels:
- traefik.enable=true
- traefik.routers.rt-server3.entryPoints=http
- traefik.routers.rt-server3.rule=Host:frontend2.docker.local
- traefik.routers.rt-server3.rule=Host("frontend2.docker.local")
- traefik.services.service2.loadbalancer.server.port=80
- traefik.services.service2.loadbalancer.method=drr
authFrontend:
@ -33,7 +33,7 @@ authFrontend:
labels:
- traefik.enable=true
- traefik.routers.rt-authFrontend.entryPoints=httpFrontendAuth
- traefik.routers.rt-authFrontend.rule=Host:frontend.auth.docker.local
- traefik.routers.rt-authFrontend.rule=Host("frontend.auth.docker.local")
- traefik.routers.rt-authFrontend.middlewares=basicauth
- traefik.middlewares.basicauth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/
- traefik.services.service3.loadbalancer.server.port=80
@ -42,7 +42,7 @@ digestAuthMiddleware:
labels:
- traefik.enable=true
- traefik.routers.rt-digestAuthMiddleware.entryPoints=digestAuth
- traefik.routers.rt-digestAuthMiddleware.rule=Host:entrypoint.digest.auth.docker.local
- traefik.routers.rt-digestAuthMiddleware.rule=Host("entrypoint.digest.auth.docker.local")
- traefik.routers.rt-digestAuthMiddleware.middlewares=digestauth
- traefik.middlewares.digestauth.digestauth.users=test:traefik:a2688e031edb4be6a3797f3882655c05, test2:traefik:518845800f9e2bfb1f1f740ec24f074e
- traefik.services.service3.loadbalancer.server.port=80
@ -51,7 +51,7 @@ frontendRedirect:
labels:
- traefik.enable=true
- traefik.routers.rt-frontendRedirect.entryPoints=frontendRedirect
- traefik.routers.rt-frontendRedirect.rule=Path:/test
- traefik.routers.rt-frontendRedirect.rule=Path("/test")
- traefik.routers.rt-frontendRedirect.middlewares=redirecthttp
- traefik.middlewares.redirecthttp.redirectScheme.scheme=http
- traefik.middlewares.redirecthttp.redirectScheme.port=8000
@ -61,7 +61,7 @@ rateLimit:
labels:
- traefik.enable=true
- traefik.routers.rt-rateLimit.entryPoints=httpRateLimit
- traefik.routers.rt-rateLimit.rule=Host:ratelimit.docker.local
- traefik.routers.rt-rateLimit.rule=Host("ratelimit.docker.local")
- traefik.routers.rt-rateLimit.middlewares=rate
- traefik.middlewares.rate.ratelimit.extractorfunc=client.ip
- traefik.middlewares.rate.ratelimit.rateset.Rate0.average=1
@ -73,7 +73,7 @@ frontendWhitelist:
labels:
- traefik.enable=true
- traefik.routers.rt-frontendWhitelist.entryPoints=http
- traefik.routers.rt-frontendWhitelist.rule=Host:frontend.whitelist.docker.local
- traefik.routers.rt-frontendWhitelist.rule=Host("frontend.whitelist.docker.local")
- traefik.routers.rt-frontendWhitelist.middlewares=wl
- traefik.middlewares.wl.ipwhitelist.sourcerange=8.8.8.8/32
- traefik.services.service3.loadbalancer.server.port=80

View file

@ -1,5 +0,0 @@
whoami1:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.frontend.rule=AddPrefix:/whoami;PathPrefix:/

View file

@ -2,7 +2,7 @@ whoami1:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.routers.router1.rule=PathPrefix:/whoami
- traefik.routers.router1.rule=PathPrefix("/whoami")
whoami2:
image: containous/whoami

View file

@ -3,4 +3,4 @@ server1:
labels:
- traefik.enable=true
- traefik.services.service1.loadbalancer.server.port=80
- traefik.routers.router1.rule=Host:github.com
- traefik.routers.router1.rule=Host("github.com")

View file

@ -1,6 +1,6 @@
whoami1:
image: containous/whoami
labels:
- traefik.Routers.RouterMini.Rule=PathPrefix:/whoami
- traefik.Routers.RouterMini.Rule=PathPrefix("/whoami")
- traefik.enable=true

View file

@ -2,6 +2,6 @@ whoami:
image: containous/whoami
labels:
- traefik.frontend.passTLSClientCert.pem=true
- traefik.routers.route1.rule=PathPrefix:/
- traefik.routers.route1.rule=PathPrefix(`/`)
- traefik.routers.route1.middlewares=passtls
- traefik.middlewares.passtls.passtlsclientcert.pem=true

View file

@ -2,7 +2,7 @@ noOverrideWhitelist:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.routers.rt1.rule=Host:no.override.whitelist.docker.local
- traefik.routers.rt1.rule=Host("no.override.whitelist.docker.local")
- traefik.routers.rt1.middlewares=wl1
- traefik.middlewares.wl1.ipwhiteList.sourceRange=8.8.8.8
@ -10,7 +10,7 @@ overrideIPStrategyRemoteAddrWhitelist:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.routers.rt2.rule=Host:override.remoteaddr.whitelist.docker.local
- traefik.routers.rt2.rule=Host("override.remoteaddr.whitelist.docker.local")
- traefik.routers.rt2.middlewares=wl2
- traefik.middlewares.wl2.ipwhitelist.sourceRange=8.8.8.8
- traefik.middlewares.wl2.ipwhitelist.ipStrategy=true
@ -19,7 +19,7 @@ overrideIPStrategyDepthWhitelist:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.routers.rt3.rule=Host:override.depth.whitelist.docker.local
- traefik.routers.rt3.rule=Host("override.depth.whitelist.docker.local")
- traefik.routers.rt3.middlewares=wl3
- traefik.middlewares.wl3.ipwhitelist.sourceRange=8.8.8.8
- traefik.middlewares.wl3.ipwhitelist.ipStrategy.depth=3
@ -28,7 +28,7 @@ overrideIPStrategyExcludedIPsWhitelist:
image: containous/whoami
labels:
- traefik.enable=true
- traefik.routers.rt4.rule=Host:override.excludedips.whitelist.docker.local
- traefik.routers.rt4.rule=Host("override.excludedips.whitelist.docker.local")
- traefik.routers.rt4.middlewares=wl4
- traefik.middlewares.wl4.ipwhitelist.sourceRange=8.8.8.8
- traefik.middlewares.wl4.ipwhitelist.ipStrategy.excludedIPs=10.0.0.1,10.0.0.2

View file

@ -38,7 +38,7 @@ func (s *RestSuite) TestSimpleConfiguration(c *check.C) {
EntryPoints: []string{"http"},
Middlewares: []string{},
Service: "service1",
Rule: "PathPrefix:/",
Rule: "PathPrefix(`/`)",
},
},
Services: map[string]*config.Service{
@ -65,7 +65,7 @@ func (s *RestSuite) TestSimpleConfiguration(c *check.C) {
c.Assert(err, checker.IsNil)
c.Assert(response.StatusCode, checker.Equals, http.StatusOK)
err = try.GetRequest("http://127.0.0.1:8080/api/providers/rest/routers", 1000*time.Millisecond, try.BodyContains("PathPrefix:/"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/rest/routers", 1000*time.Millisecond, try.BodyContains("PathPrefix(`/`)"))
c.Assert(err, checker.IsNil)
err = try.GetRequest("http://127.0.0.1:8000/", 1000*time.Millisecond, try.StatusCodeIs(http.StatusOK))

View file

@ -31,7 +31,7 @@ func (s *RetrySuite) TestRetry(c *check.C) {
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("PathPrefix:/"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("PathPrefix(`/`)"))
c.Assert(err, checker.IsNil)
// This simulates a DialTimeout when connecting to the backend server.
@ -53,7 +53,7 @@ func (s *RetrySuite) TestRetryWebsocket(c *check.C) {
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("PathPrefix:/"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("PathPrefix(`/`)"))
c.Assert(err, checker.IsNil)
// This simulates a DialTimeout when connecting to the backend server.

View file

@ -455,7 +455,7 @@ func (s *SimpleSuite) TestMultiprovider(c *check.C) {
EntryPoints: []string{"http"},
Middlewares: []string{"file.customheader"},
Service: "file.service",
Rule: "PathPrefix:/",
Rule: "PathPrefix(`/`)",
},
},
}
@ -470,7 +470,7 @@ func (s *SimpleSuite) TestMultiprovider(c *check.C) {
c.Assert(err, checker.IsNil)
c.Assert(response.StatusCode, checker.Equals, http.StatusOK)
err = try.GetRequest("http://127.0.0.1:8080/api/providers/rest/routers", 1000*time.Millisecond, try.BodyContains("PathPrefix:/"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/rest/routers", 1000*time.Millisecond, try.BodyContains("PathPrefix(`/`)"))
c.Assert(err, checker.IsNil)
err = try.GetRequest("http://127.0.0.1:8000/", 1*time.Second, try.StatusCodeIs(http.StatusOK), try.BodyContains("CustomValue"))

View file

@ -31,7 +31,7 @@ func (s *TimeoutSuite) TestForwardingTimeouts(c *check.C) {
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("Path:/dialTimeout"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/file/routers", 60*time.Second, try.BodyContains("Path(`/dialTimeout`)"))
c.Assert(err, checker.IsNil)
// This simulates a DialTimeout when connecting to the backend server.

View file

@ -50,7 +50,7 @@ func (s *TLSClientHeadersSuite) TestTLSClientHeaders(c *check.C) {
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
err = try.GetRequest("http://127.0.0.1:8080/api/providers/docker/routers", 2*time.Second, try.BodyContains("PathPrefix:/"))
err = try.GetRequest("http://127.0.0.1:8080/api/providers/docker/routers", 2*time.Second, try.BodyContains("PathPrefix(`/`)"))
c.Assert(err, checker.IsNil)
request, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:8443", nil)