Websockets notes
Testing websockets
To test a websocket connection, say, to a Luanti mapserver instance.
Ripped from https://gist.github.com/htp/fbce19069187ec1cc486b594104f01d0
curl 'ws://server3/games/luanti/dummy1/map/api/ws'\
-H 'Sec-WebSocket-Version: 13'\
-H 'Origin: http://server3/games/luanti/dummy1/map'\
-H 'Sec-WebSocket-Extensions: permessage-deflate'\
-H 'Sec-WebSocket-Key: iZk5UQJ14b3gQx3/T3jBmv=='\
-H 'Sec-GPC: 1'\
-H 'Connection: Upgrade'\
-H 'Upgrade: websocket'
Apache 2.4.37 configs
For Rocky Linux 9 which doesn't have the 2.4.47 "upgrade=websocket" syntax yet.
# mapserver RewriteRule ^/games/luanti/dummy1/map$ /games/luanti/dummy1/map/ [R,L] # WebSocket route must precede the broader HTTP map route. ProxyPass "/games/luanti/dummy1/map/api/ws" "ws://vm6:30101/api/ws" ProxyPassReverse "/games/luanti/dummy1/map/api/ws" "ws://vm6:30101/api/ws" # Other mapserver HTTP requests ProxyPass "/games/luanti/dummy1/map/" "http://vm6:30101/" ProxyPassReverse "/games/luanti/dummy1/map/" "http://vm6:30101/" <Location "/games/luanti/dummy1/map/"> ProxyPreserveHost On RequestHeader set X-Script-Name "/games/luanti/dummy1/map" </Location>
Comments