LXD/HAproxy/Nodejs

So I have the following configuration:

Drawing1

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://127.0.0.1:9001
// 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?

Thanks,

Ray

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.