Match Query rule with a range?

Is there a way to to specify a range with a match "Query" rule? For example:

Query(key1=10001) => Query(key1=50001)

According to the documentation it matches Query String parameters. It accepts a sequence of key=value pairs. You might be able to have some luck with RegExp instead but it's going to become quite complex.

@ldez - I can see how this could be useful, do you want me to open a feature request for this on GitHub?

I tried to do regexp with "Path" and I can't get it to work:
Path(/bar/foo?rev={2019-0[12].*}) OR Path(/bar/foo?rev={2019-03-0.*}) OR Path(/bar/fool?rev={2019-03-1[0-4]})

Path support only exact path.
Query parameters are not a part of a path.

For now, there is no way to do that.

@zespri feel free to open a feature request about queryRegexp matcher.

I checked the code and Query() matcher support regex.



When I do

- match: Query(rev=201[0-8] || 2019-0[12] || 2019-03-0 || 2019-03-1[0-4])

traefik complains

"level=error msg="error while parsing rule Query(rev=201[0-8] || 2019-0[12] || 2019-03-0 || 2019-03-1[0-4]): 1:14: expected '==', found '='" routerName=ingressroute-11111@kubernetescrd entryPointName=web"

So with:

  • match: Query(rev={rev:(201[0-8])|(2019-0[12])|(2019-03-0)|(2019-03-1[0-4])})
    kind: Rule

I tested it with this curl command and got a 404:
$ curl -k -sS -X GET http://traefik.local/foo/bar?rev=2019-01-03 -H "Authorization: Bearer $token" -H "X-Subject-Token: fake"
404 page not found

The traefik log shows: - - [19/Nov/2019:22:02:36 +0000] "GET /foo/bar?rev=2019-01-03 HTTP/1.1" 404 19 "-" "-" 1 - - 4ms