Blame


1 fcad6b29 2024-03-22 jrmu version=pmwiki-2.3.20 ordered=1 urlencoded=1
2 fcad6b29 2024-03-22 jrmu agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
3 fcad6b29 2024-03-22 jrmu author=miniontoby
4 fcad6b29 2024-03-22 jrmu charset=UTF-8
5 fcad6b29 2024-03-22 jrmu csum=Initial instructions
6 fcad6b29 2024-03-22 jrmu ctime=1710963755
7 fcad6b29 2024-03-22 jrmu host=45.136.74.157
8 fcad6b29 2024-03-22 jrmu name=Relayd.Wss-Draft
9 fcad6b29 2024-03-22 jrmu rev=1
10 fcad6b29 2024-03-22 jrmu targets=Relayd.Acceleration
11 fcad6b29 2024-03-22 jrmu text=!! Relayd with WSS%0a%0aSome apps, mostly like multiplayer games, are running on a port and need an websocket.%0a%0aMost of the time you would want to put it on a subdomain, but then the websocket should still go on a port, but the software doesn't allow it, since it polls using http first and then connects to websocket and they just cannot be seperate ports.%0a%0aThis is why you should add these things to your relayd.conf%0a%0a%0a!!! Instructions%0a%0aWe assume your relayd.conf looks like this:%0a[@%0ahttp protocol https {%0a match request header append "X-Forwarded-For" value "$REMOTE_ADDR"%0a match request header append "X-Forwarded-By" \%0a value "$SERVER_ADDR:$SERVER_PORT"%0a match request header set "Connection" value "close"%0a tcp { sack, backlog 128 }%0a tls { keypair service1.example.com }%0a tls { keypair service2.example.com }%0a match request header "Host" value "service1.example.com" forward to %3cservice1>%0a match request header "Host" value "service2.example.com" forward to %3cservice2>%0a}%0a@]%0aP.s. this is the config from [[Relayd.Acceleration]]%0a%0aNow, in order to add support for websockets, just add these lines before the [@tcp { sack, backlog 128 }@] line%0a%0a[@%0a match request header "Upgrade" value "websocket" header set "Connection" value "upgrade"%0a http websockets%0a@]%0a%0aThis would result into:%0a[@%0ahttp protocol https {%0a match request header append "X-Forwarded-For" value "$REMOTE_ADDR"%0a match request header append "X-Forwarded-By" \%0a value "$SERVER_ADDR:$SERVER_PORT"%0a match request header set "Connection" value "close"%0a match request header "Upgrade" value "websocket" header set "Connection" value "upgrade"%0a http websockets%0a tcp { sack, backlog 128 }%0a tls { keypair service1.example.com }%0a tls { keypair service2.example.com }%0a match request header "Host" value "service1.example.com" forward to %3cservice1>%0a match request header "Host" value "service2.example.com" forward to %3cservice2>%0a}%0a@]%0a%0aNow reload your relayd using [@doas rcctl reload relayd@] and you should be good to go!
12 fcad6b29 2024-03-22 jrmu time=1710963755
13 fcad6b29 2024-03-22 jrmu author:1710963755=miniontoby
14 fcad6b29 2024-03-22 jrmu csum:1710963755=Initial instructions
15 fcad6b29 2024-03-22 jrmu diff:1710963755:1710963755:=1,52d0%0a%3c !! Relayd with WSS%0a%3c %0a%3c Some apps, mostly like multiplayer games, are running on a port and need an websocket.%0a%3c %0a%3c Most of the time you would want to put it on a subdomain, but then the websocket should still go on a port, but the software doesn't allow it, since it polls using http first and then connects to websocket and they just cannot be seperate ports.%0a%3c %0a%3c This is why you should add these things to your relayd.conf%0a%3c %0a%3c %0a%3c !!! Instructions%0a%3c %0a%3c We assume your relayd.conf looks like this:%0a%3c [@%0a%3c http protocol https {%0a%3c match request header append "X-Forwarded-For" value "$REMOTE_ADDR"%0a%3c match request header append "X-Forwarded-By" \%0a%3c value "$SERVER_ADDR:$SERVER_PORT"%0a%3c match request header set "Connection" value "close"%0a%3c tcp { sack, backlog 128 }%0a%3c tls { keypair service1.example.com }%0a%3c tls { keypair service2.example.com }%0a%3c match request header "Host" value "service1.example.com" forward to %3cservice1>%0a%3c match request header "Host" value "service2.example.com" forward to %3cservice2>%0a%3c }%0a%3c @]%0a%3c P.s. this is the config from [[Relayd.Acceleration]]%0a%3c %0a%3c Now, in order to add support for websockets, just add these lines before the [@tcp { sack, backlog 128 }@] line%0a%3c %0a%3c [@%0a%3c match request header "Upgrade" value "websocket" header set "Connection" value "upgrade"%0a%3c http websockets%0a%3c @]%0a%3c %0a%3c This would result into:%0a%3c [@%0a%3c http protocol https {%0a%3c match request header append "X-Forwarded-For" value "$REMOTE_ADDR"%0a%3c match request header append "X-Forwarded-By" \%0a%3c value "$SERVER_ADDR:$SERVER_PORT"%0a%3c match request header set "Connection" value "close"%0a%3c match request header "Upgrade" value "websocket" header set "Connection" value "upgrade"%0a%3c http websockets%0a%3c tcp { sack, backlog 128 }%0a%3c tls { keypair service1.example.com }%0a%3c tls { keypair service2.example.com }%0a%3c match request header "Host" value "service1.example.com" forward to %3cservice1>%0a%3c match request header "Host" value "service2.example.com" forward to %3cservice2>%0a%3c }%0a%3c @]%0a%3c %0a%3c Now reload your relayd using [@doas rcctl reload relayd@] and you should be good to go!%0a\ No newline at end of file%0a
16 fcad6b29 2024-03-22 jrmu host:1710963755=45.136.74.157