Routing based on url parameter?

Hello all,

Is there a way to route to specific service by url parameter, without naming all combinations into file ?

For example if I have ?host=service-1 in url route it to service called "service-1" I need extract the value. Something like that can be done in HAproxy that I'm trying to abandon :smiley: like this:

use_backend %[urlp(host)] if { urlp(host) -m found }

That would route to backend based on the host value ( and if its found in the url) , any idea how to do that in Traefik ?

hello @vladoportos

There is no automatic way of creating services and routing based on query parameters. However, Traefik can automatically create a service and router and then use DefaultRule to expose the application. I presented that feature while presenting Traefik Consul Catalog provider in the latest webinar.

Here is the link that demo: Explore All the New Features of Traefik Proxy 2.6 - YouTube

and the source code with the initial configuration:

You can also consider the Query matcher to build a matching rule but the service has to be created.