Forwarding HTTP to specific LXD Containers?


I am using Ubuntu server with LXD containers for a project I am working on. So for each container, there are specific rtmp and http requests. I can forward the rtmp to the right container, but having a problem figuring out the haproxy config for http.

I send the rtmp from OBS using the following URL config in the streaming tab:

rtmp://“server IP:1935”/LPC1 (or LPC2, LPC3, etc).
The port would be 1936 for LPC2, 1937 for LPC3, etc. This seems to work fine.

However, after the rtmp, there is also an http request that comes in. That request comes in as:

http://“server IP:8935”/stream/xxxxxxxxxx.m3u8.

The IP and port # for the http is always the same. So, for example if the rtmp should forward to LPC1, how can I configure haproxy for this http to also go to LPC1? How about LPC2?

Here is a snippet of the haproxy.cfg I am currently using. I have obfuscated the server IP. The back ends are the LXD containers.

frontend LPC1
mode tcp
bind xx.xx.xx.xx:1935
default_backend LPC1-backend

frontend LPC2
mode tcp
bind xx.xx.xx.xx:1936
default_backend LPC2-backend

frontend LPC3
mode tcp
bind xx.xx.xx.xx:1937
default_backend LPC3-backend

frontend LPC4
mode tcp
bind xx.xx.xx.xx:1938
default_backend LPC4-backend

backend LPC1-backend
mode tcp
server LPC1

backend LPC2-backend
mode tcp
server LPC2

backend LPC3-backend
mode tcp
server LPC3

backend LPC4-backend
mode tcp
server LPC4

I hope I articulated my problem good enough?

Thanks and I appreciate the help on this…