# Length of load balancing variable?

**URL:** <https://discourse.haproxy.org/t/length-of-load-balancing-variable/8838>\
**Category:** Help!\
**Created:** [July 11, 2023, 10:35am UTC](https://discourse.haproxy.org/t/length-of-load-balancing-variable/8838 "2023-07-11T10:35:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimScotland](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/timscotland/32/1378_2.png) [@TimScotland](https://discourse.haproxy.org/u/TimScotland)\
**Post date:** [July 11, 2023, 10:35am UTC](https://discourse.haproxy.org/t/length-of-load-balancing-variable/8838/1 "2023-07-11T10:35:06Z")

</div>

Hello all.

I have a strange one that I’m not certain if it’s an haproxy issue or a Collabora Office Online issue. Naturally when working with Collabora support they want it to be an haproxy issue 🙂

The backend element looks like:  
mode http  
timeout tunnel 3600s  
balance url\_param WOPISrc check\_post  
hash-type consistent  
server edit1 10.0.100.48:9980  
server edit2 10.0.100.49:9980

For most of the system all works as intended but when dealing with cutting and pasting in a template (basically in a quite obscure area of the program) suddenly CTRL-C and CTRL-V stop working. If one works back to a new open document it all works again.

Initially I thought there was no way that this is an HAProxy problem, and I said so volubly! But I then tried a test…

I commented out one of the servers in the back end. And it all works.  
I then changed backend servers, it still works!

As soon as the load balance element has more than one server listed, it fails.

So the only possible issue that I have come up with is that there a size limitation on the variable url\_param - in this case WOPISrc. This can be nearly 600 characters (certainly over 512) could this be a cause?

Thanks to all as always,

Tim

---

<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:** [July 11, 2023, 1:32pm UTC](https://discourse.haproxy.org/t/length-of-load-balancing-variable/8838/2 "2023-07-11T13:32:26Z")

</div>

Even if the `url_param` would be truncated, it should not lead to erroneous load balancing, it would just not consider the entire string.

If the string is `abcdefgh` but haproxy only looks at `abc`, `abcdefgh` will always lead to `abc` and therefor it would lead to the same load balancing decision.

If would recommend against using `url_param`, unless Collabora has specifically told you that the `WOPISrc` get parameter is what you need to look at for a load-balancing decision in front of multiple bcakend servers.

This would require that the `WOPISrc` get parameter is present in every single request in the entire application, it is never offloaded to cookie or session storage.

I just don’t believe that this is actually the case. If you want to go down that rabbit hole, turn on HTTP logging of verify every single HTTP transaction, and check whether haproxy routes the request to the correct backend server or not.

But by relying on a GET parameter of the application you are making your setup fragile.

I’d suggest alternatives:

- `balance source` just load-balance based on the source IP without any HTTP or cookies requirements
- or use cookies stickiness instead, by using a dedicated haproxy cookies for load-balancing decisions

config example:

```
backend test
 mode http
 balance roundrobin
 cookie HAPLB insert indirect nocache
 server edit1 cookie edit1 10.0.100.48:9980
 server edit2 cookie edit2 10.0.100.49:9980

```

---

<div class="post-metadata">

**Author:** ![TimScotland](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/timscotland/32/1378_2.png) [@TimScotland](https://discourse.haproxy.org/u/TimScotland)\
**Post date:** [July 11, 2023, 1:55pm UTC](https://discourse.haproxy.org/t/length-of-load-balancing-variable/8838/3 "2023-07-11T13:55:34Z")

</div>

Thanks Lukas,

The problem behind and the reason for the use of url\_param is that we can end up with multiple people co-editing a single document and therefore they HAVE to go to the same page and that requires the use of WOPISrc. I don’t like it, but it is necessary.

I get your point that the url being truncated would always still point to the one location.

My problem remains though, if no second server available it works. as soon as there is a second server we see the failure. Why? What are the other alternatives that could be at play here?

Just to be 100% clear, if you type in a document template it works, it’s just the CTRL-C and CTRL-V that fail.

Thanks

Tim

---

<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:** [July 11, 2023, 1:58pm UTC](https://discourse.haproxy.org/t/length-of-load-balancing-variable/8838/4 "2023-07-11T13:58:44Z")

</div>

Like I said:

> [@lukastribus](#):
>
> If you want to go down that rabbit hole, turn on HTTP logging of verify every single HTTP transaction, and check whether haproxy routes the request to the correct backend server or not.
