# Help creating content rule from parameter

**URL:** <https://discourse.haproxy.org/t/help-creating-content-rule-from-parameter/3106>\
**Category:** Help!\
**Created:** [October 17, 2018, 9:41pm UTC](https://discourse.haproxy.org/t/help-creating-content-rule-from-parameter/3106 "2018-10-17T21:41:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddiie](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@Eddiie](https://discourse.haproxy.org/u/Eddiie)\
**Post date:** [October 17, 2018, 9:41pm UTC](https://discourse.haproxy.org/t/help-creating-content-rule-from-parameter/3106/1 "2018-10-17T21:41:10Z")

</div>

Hello,

HAProxy 1.6.3

I need some help creating acls to branch based off a URL Parameter.

Example: [http://www.mysitesample.com/my/site/is/here/myfile.aspx?parameter1=foo&clientid=bar01&index=100](http://www.mysitesample.com/my/site/is/here/myfile.aspx?parameter1=foo&clientid=bar01&index=100)

I want to switch send traffic to backend servers matching a range of what “clientid” equals, type is text.  
Samples of what clientid can equal: Client01, client01, CLIENT01, cLIENT01, CottageCheese01, Bluesky03 (and all upper/lower case variants), might not be the word client at all. more like the client’s name. The text ‘bar01’ is a sample and not a constant) and the ClientID parameter can appear anywhere in the client list.

say  
Client01 through client05 goes to backend 1  
Client06 through client10 goes to backend 2  
CottageCheese01 or Bluesky03 goes to backend 3  
If all else fails, go to backend 4.

Hopefully this explains it.  
thank you!

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [October 18, 2018, 9:58pm UTC](https://discourse.haproxy.org/t/help-creating-content-rule-from-parameter/3106/2 "2018-10-18T21:58:27Z")

</div>

Query is in the string query:  
[https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#7.3.6-query](https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#7.3.6-query)

You can match it with regular expressions, exact matches or substring matches, among other things:  
[https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#7.1.3](https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#7.1.3)

And then you just use [use\_backend](https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-use_backend) and [default\_backend](https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-default_backend)

```
acl clients_for_backend1 query -m reg -i clientid=client0[1-5]

acl clients_for_backend2 query -m reg -i clientid=client0[6-9]
acl clients_for_backend2 query -m sub -i clientid=client10

acl clients_for_backend3 query -m sub -i clientid=CottageCheese01
acl clients_for_backend3 query -m sub -i clientid=Bluesky03

use_backend backend1 clients_for_backend1
use_backend backend2 clients_for_backend2
use_backend backend3 clients_for_backend3
default_backend backend4
```
