4

I have an issue where I need the same RTMP TCP connection to hit the same server it connected with if it was http or https. The following works with http:

frontend http
    mode http
    bind :80
    default_backend web_servers

frontend rtmp
    mode tcp
    bind :1935
    default_backend rtmp

backend web_servers
    mode http
    option forwardfor
    balance roundrobin
    stick store-request src 
    stick-table type ip size 200k expire 2m
    server web1 10.0.0.2:8080 check
    server web2 10.0.0.3:8080 check

backend rtmp
    mode tcp
    stick match src table web_servers
    server web1 10.0.0.2:1935 
    server web2 10.0.0.3:1935 

My question is if I introduce https connection, how would I distinguish to use the same backend server it connects to if it is http or https. I tried to see if I can use 2 "stick match src table" entries, but that doesn't work. For example, I tried the following and I hope you get the idea of what I'm trying to accomplish.

frontend http
    mode http
    bind :80
    default_backend web_servers

frontend https
    bind :8081
    default_backend https

frontend rtmp
    mode tcp
    bind :1935
    default_backend rtmp

backend web_servers
    mode http
    option forwardfor
    balance roundrobin
    stick store-request src 
    stick-table type ip size 200k expire 2m
    server web1 10.0.0.2:8080 check
    server web2 10.0.0.3:8080 check

backend https
    balance roundrobin
    stick store-request src
    stick-table type ip size 200k expire 30m
    option forwardfor
    reqadd X-Forwarded-Proto:\ https
    server web1 10.0.0.2:8080 check
    server web2 10.0.0.3:8080 check


backend rtmp
    mode tcp
    stick match src table web_servers
    stick match src table https   <-- I added this
    server web1 10.0.0.2:1935 
    server web2 10.0.0.3:1935

The above doesn't work when I try with https. If I comment out one, the other will work so there is a conflict. I will probably have to add a condition and I've tried a few but not having any luck. Any pointers? Thanks in advance.

ChriSxStyles
  • 383
  • 1
  • 3
  • 11

0 Answers0