1
0
Fork 0

Update routing syntax

Co-authored-by: Tom Moulard <tom.moulard@traefik.io>
This commit is contained in:
Antoine 2022-11-28 15:48:05 +01:00 committed by GitHub
parent b93141992e
commit 4d86668af3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 2484 additions and 2085 deletions

View file

@ -20,12 +20,12 @@
[http.routers]
[http.routers.router1]
rule = "HostRegexp(`{subdomain:[a-z1-9-]+}.snitest.com`)"
rule = "HostRegexp(`[a-z1-9-]+\\.snitest\\.com`)"
service = "service1"
[http.routers.router1.tls]
[http.routers.router2]
rule = "HostRegexp(`{subdomain:[a-z1-9-]+}.www.snitest.com`)"
rule = "HostRegexp(`[a-z1-9-]+\\.www\\.snitest\\.com`)"
service = "service1"
[http.routers.router2.tls]

View file

@ -4,6 +4,7 @@
[log]
level = "DEBUG"
noColor = true
[entryPoints]
[entryPoints.webHost]
@ -30,12 +31,12 @@
[http.routers.router2]
entryPoints = ["webHostRegexp"]
service = "service1"
rule = "!HostRegexp(`test.localhost`)"
rule = "!HostRegexp(`test\\.localhost`)"
[http.routers.router3]
entryPoints = ["webQuery"]
service = "service1"
rule = "!Query(`foo=`)"
rule = "!QueryRegexp(`foo`, `.*`)"
[http.services]

View file

@ -24,7 +24,7 @@
[http.routers]
[http.routers.router1]
service = "service1"
rule = "Path(`/echo`,`/ws`)"
rule = "Path(`/echo`) || Path(`/ws`)"
[http.routers.router1.tls]
[http.services]

View file

@ -1092,7 +1092,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicCaseInsensitive(c *check.C) {
defer s.killCmd(cmd)
// wait for Traefik
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 500*time.Millisecond, try.BodyContains("HostRegexp(`{subdomain:[a-z1-9-]+}.www.snitest.com`)"))
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 500*time.Millisecond, try.BodyContains("HostRegexp(`[a-z1-9-]+\\\\.www\\\\.snitest\\\\.com`)"))
c.Assert(err, checker.IsNil)
tlsConfig := &tls.Config{

View file

@ -1337,7 +1337,7 @@ func (s *SimpleSuite) TestMuxer(c *check.C) {
expected: http.StatusOK,
},
{
desc: "!Query with semicolon, no match",
desc: "!Query with semicolon and empty query param value, no match",
request: "GET /?foo=; HTTP/1.1\r\nHost: other.localhost\r\n\r\n",
target: "127.0.0.1:8002",
expected: http.StatusNotFound,
@ -1367,9 +1367,7 @@ func (s *SimpleSuite) TestMuxer(c *check.C) {
resp, err := http.ReadResponse(bufio.NewReader(conn), nil)
c.Assert(err, checker.IsNil)
if resp.StatusCode != test.expected {
c.Errorf("%s failed with %d instead of %d", test.desc, resp.StatusCode, test.expected)
}
c.Assert(resp.StatusCode, checker.Equals, test.expected, check.Commentf(test.desc))
if test.body != "" {
body, err := io.ReadAll(resp.Body)