ポート 3030 で Express Web アプリケーションを実行していますが、これはhttp-proxy経由でプロキシされています。この方法でサイトは正常に動作しますが、socket.io は接続しません。私のコンソールが表示するように何かを受け取ります:
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 11319742841450363586
debug - setting request GET /socket.io/1/websocket/11319742841450363586
debug - set heartbeat interval for client 11319742841450363586
debug - client authorized for
debug - websocket writing 1::
app.js
app.listen(3030)
io = require('socket.io')
socket = io.listen(app)
socket.on('connection', function(client) {
console.log('new connection')
})
チャット.js
$(function() {
console.log('connecting to chat...')
var socket = io.connect('http://mydomain.com:80')
socket.on('connected',function(){
console.log('connected')
})
})
ただし、いずれの console.log ステートメントもクライアントまたはサーバー側には表示されません。私は何を間違っていますか?
編集 - http-proxy コードを追加
var httpProxy = require('http-proxy')
, proxyTable = {
router: {
'lou.mydomain.com': '127.0.0.1:3030'
, 'foe.mydomain.com': '127.0.0.1:3000'
// and some others
}
}
, proxyServer = httpProxy.createServer(proxyTable);
proxyServer.listen(80);