Skip to content
Snippets Groups Projects
Commit fa3e7132 authored by echicken's avatar echicken :chicken:
Browse files

Avoid spurious connections to the terminal server - and some

other unnecessary work - if the BBS is using HAProxy but we can't
do the thing with the stuff because we don't have the things.
parent 820b805e
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -47,6 +47,11 @@ var FWebSocketState = WEBSOCKET_NEED_PACKET_START; ...@@ -47,6 +47,11 @@ var FWebSocketState = WEBSOCKET_NEED_PACKET_START;
try { try {
// Parse and respond to the WebSocket handshake request // Parse and respond to the WebSocket handshake request
if (ShakeHands()) { if (ShakeHands()) {
if (UsingHAProxy() && FWebSocketHeader['X-Forwarded-For'] === undefined) {
throw new Error('BBS is using HAProxy, but no X-Forwarded-For header present.');
}
SendToWebSocketClient(StringToBytes("Redirecting to server...\r\n")); SendToWebSocketClient(StringToBytes("Redirecting to server...\r\n"));
// Default to localhost on the telnet port // Default to localhost on the telnet port
...@@ -88,11 +93,7 @@ try { ...@@ -88,11 +93,7 @@ try {
var ServerData = []; var ServerData = [];
if (UsingHAProxy()) { if (UsingHAProxy()) {
if (FWebSocketHeader['X-Forwarded-For'] !== undefined) {
// Do HAProxy stuff here // Do HAProxy stuff here
} else {
throw new Error('BBS is using HAProxy, but no X-Forwarded-For header present.');
}
} }
// Loop while we're still connected on both ends // Loop while we're still connected on both ends
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment