Say if I want to open two ports, one for the public at 8080, and another one to process some public request but was forwarded by the 8080 port like such:
const http = require('http');
const publicServer = http.createServer(...).listen(8080);
const privateServer = http.createServer(...).listen(9999);
publicServer.on('connect', (req, cltSocket, head) => {
...
if (...) {
// let srvSocket = net.connect('9999', 'localhost', () => {
let srvSocket = net.connect('9999', '127.0.0.1', () => {
cltSocket.write('\r\n\r\n');
srvSocket.write(head);
srvSocket.pipe(cltSocket);
cltSocket.pipe(srvSocket);
});
}
});
Is there some type of settings I can use to allow this? Currently it seems Openshift doesn't allow this setup. It is possible that it doesn't honor 127.0.0.1
or localhost
and therefore not forwarding the request to the correct pod...