# Stick on url\_param

**URL:** <https://discourse.haproxy.org/t/stick-on-url-param/10221>\
**Category:** Help!\
**Created:** [September 12, 2024, 1:32pm UTC](https://discourse.haproxy.org/t/stick-on-url-param/10221 "2024-09-12T13:32:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sticky\_session](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sticky\_session](https://discourse.haproxy.org/u/sticky_session)\
**Post date:** [September 12, 2024, 1:32pm UTC](https://discourse.haproxy.org/t/stick-on-url-param/10221/1 "2024-09-12T13:32:02Z")

</div>

Hello. I would like to ask if it is possible to stick to individual server based on url\_param?

I have HAProxy load balancer and couple of proxies as a backend. I would like to stick to one of the backend proxies if the url\_param is matching with one stored in stick table.

I have config file:

```auto
frontend testfrontend
        bind IP:PORT
        default_backend proxies
backend proxies
        stick-table type string size 1m expire 1h
        stick on url_param(session_id) table proxies
        stick store-request url_param(session_id) table proxies
        http-request set-uri '%[url,regsub("^(.*)(&|\?)session_id[^&]*(?:&|$)(.*)",\1\2\3)]'

        # Hosts
        server host1 IP:PORT check
        server host2 IP:PORT check
        server host3 IP:PORT check
        server host4 IP:PORT check

```

It should now stick to session on matching url param but it doesn’t and instead it is cycling through proxies.

---

<div class="post-metadata">

**Author:** ![sticky\_session](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sticky\_session](https://discourse.haproxy.org/u/sticky_session)\
**Post date:** [September 13, 2024, 10:05am UTC](https://discourse.haproxy.org/t/stick-on-url-param/10221/2 "2024-09-13T10:05:59Z")

</div>

The issue here were in link definition. As the front-end isn’t secured by SSL cert so it can handle only insecure traffic (http).

The working config:

```auto
frontend frontend
        bind localIP:Port
        stick-table type string size 1m expire 1h
        acl has_session_id url_param(session_id) -m found
        use_backend proxies if has_session_id

backend proxies
        stick on url_param(session_id) table frontend
        stick store-request url_param(session_id) table frontend

        # Hosts
        server host1 IP:PORT check
        server host2 IP:PORT check
        server host3 IP:PORT check
        server host4 IP:PORT check

```

it only works on insecure connections: `curl -x IP:PORT "http://HOSTNAME.com?session_id=123"`
