spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

h2 protocol ignored in Node 4.x #279

Closed tony19 closed 7 years ago

tony19 commented 7 years ago

When requesting the h2 protocol under Node 4.5.0, node-spdy silently starts the server (without any warnings or errors), and serves files over http/1.1 instead of h2 (as seen in DevTools Network panel). This does not occur in Node 6.6.0.

I'm using the sample code from your README:

var spdy = require('spdy'),
    fs = require('fs');

var options = {
  key: fs.readFileSync('key.pem'),
  cert: fs.readFileSync('cert.pem'),

  spdy: {
    protocols: ['h2']
  }
};

var server = spdy.createServer(options, function(req, res) {
  res.writeHead(200);
  res.end('hello world!');
});

server.listen(3000);

Here's a repo that demonstrates the problem: https://github.com/tony19-contrib/node-spdy-bug

Environment

indutny commented 7 years ago

@tony19 I'm afraid ALPN (which is required for h2) isn't supported by node.js <= v4.x . Sorry!