> ## Content Index
> Fetch the complete content index at: https://ostreff.info/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to made Websocket traffic to go via  HAProxy
- URL: https://ostreff.info/how-to-haproxy-made-web-sockets/
- Published: 2021-01-28T15:50:26.000Z
- Updated: 2025-10-08T15:14:39.000Z
- Author: Jordan Ostreff
- Tags: HAProxy

The solution was simple: Tell HAProxy to tag Websocket traffic, and set up a separate but otherwise identical backend for this specific use case. 

One of typical applications which is using Websocket traffic is [Slack](https://slack.com/?ref=ostreff.info). An excelent opensource alternative of it named [Mattermost](https://mattermost.com/?ref=ostreff.info). The result looks something like this in the config file named haproxy.conf:

acl host\_ws hdr\_beg(Host) -i ws.  
acl hdr\_connection\_upgrade hdr(Connection) -i upgrade  
acl hdr\_upgrade\_websocket hdr(Upgrade) -i websocket  
use\_backend bk\_ws\_mattermost if host\_ws { hdr(Host) -i slack.ostreff.info }  
use\_backend bk\_ws\_mattermost if hdr\_connection\_upgrade hdr\_upgrade\_websocket { hdr(Host) -i slack.ostreff.info }  
use\_backend bk\_mattermost if { hdr(Host) -i slack.ostreff.info }

backend bk\_mattermost  
server mattermost 127.0.0.1:8065 check

backend bk\_ws\_mattermost  
server mattermost 127.0.0.1:8065 check