-1
const http = require('http');
const server = http.createServer(...).listen(8080);
server.on('connect', (req, cltSocket, head) => {
  console.log('This step will never be activated!');
  ...
  if (...) {
    let srvSocket = net.connect('9999', '127.0.0.1', () => {
      cltSocket.write('\r\n\r\n');
      srvSocket.write(head);
      srvSocket.pipe(cltSocket);
      cltSocket.pipe(srvSocket);
    });
  }
});

On Openshift 3 Online require('http').createServer().listen(port).on('connect', fn) will never be activated. Do anyone knows the mechanism behind this challenging behavior and how to resolve it?

P.S. This is not really a duplicated question because in "How to open an internal port in Openshift 3 Online" the question is about opening an internal port. The extended question is "How to get require('http').createServer().listen(port).on('connect', fn) to work on Openshift 3 Online."

4

1 回答 1

1

Openshift Online 阻止“连接”事件,其反向代理处理它并返回 502 错误。该事件永远不会到达您的 pod。

于 2018-04-19T15:30:57.230 回答