Blame


1 fcad6b29 2024-03-22 jrmu version=pmwiki-2.3.20 ordered=1 urlencoded=1
2 fcad6b29 2024-03-22 jrmu agent=w3m/0.5.3+git20230121
3 fcad6b29 2024-03-22 jrmu author=jrmu
4 fcad6b29 2024-03-22 jrmu charset=UTF-8
5 fcad6b29 2024-03-22 jrmu csum=Thanks to miniontoby!
6 fcad6b29 2024-03-22 jrmu ctime=1710963755
7 fcad6b29 2024-03-22 jrmu host=104.167.242.140
8 fcad6b29 2024-03-22 jrmu name=Relayd.Wss
9 fcad6b29 2024-03-22 jrmu rev=2
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=1710972788
13 fcad6b29 2024-03-22 jrmu author:1710972788=jrmu
14 fcad6b29 2024-03-22 jrmu csum:1710972788=Thanks to miniontoby!
15 fcad6b29 2024-03-22 jrmu diff:1710972788:1710963755:=
16 fcad6b29 2024-03-22 jrmu host:1710972788=104.167.242.140
17 fcad6b29 2024-03-22 jrmu author:1710963755=miniontoby
18 fcad6b29 2024-03-22 jrmu csum:1710963755=Initial instructions
19 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
20 fcad6b29 2024-03-22 jrmu host:1710963755=45.136.74.157