So I have the following configuration:


Host forwards ports 80 and 443 to HAproxy Container 1.
HAproxy forwards to Webserver Container 2 is working for http and https.

Now, using a sub-domain xxxx.mydomain.us, HAproxy acl on xxxx subdomain should route to nodejs app, but getting 502 Bad Gateway The server returned an invalid or incomplete response.
The connection is secure Letsencrypt. The nodejs server is running on port 9001.

Some of my server code is the following and works on a standalone server (non-containerized):

// http://localhost:9001

const fs = require('fs');
const path = require('path');
const url = require('url');
var httpServer = require('http');

const ioServer = require('socket.io');
const RTCMultiConnectionServer = require('rtcmulticonnection-server');

var PORT = 9001;
var isUseHTTPs = true;

const jsonPath = {
    config: 'config.json',
    logs: 'logs.json'

Is there something special I should be doing for this to work?



can you post the haproxy frontend and backend for the broken node

Thanks… I fixed the problem, which turned out to be a socket.io issue.