When using the Node.js https module, using req.connection.server in a request results in a Server instance.
This example code logs a Server instance (as expected):
var https = require('https');
var server = https.createServer(options, function(req, res) {
console.log('Server:', req.connection.server);
res.writeHead(200);
res.end('hello world!');
});
server.listen(3001);
Note that I executed the script and browsed to https://localhost:3000.
After replacing the first line to var https = require('spdy');, req.connection.server now returns null. This breaks http-proxy-middleware, which relies on this property to be set when using it with a WebSocket (see https://github.com/chimurai/http-proxy-middleware/issues/143).
When using the Node.js
https
module, usingreq.connection.server
in a request results in aServer
instance.This example code logs a
Server
instance (as expected):Note that I executed the script and browsed to
https://localhost:3000
.After replacing the first line to
var https = require('spdy');
,req.connection.server
now returnsnull
. This breakshttp-proxy-middleware
, which relies on this property to be set when using it with a WebSocket (see https://github.com/chimurai/http-proxy-middleware/issues/143).