Skip to content

node http2 error #19406

@fengyun2

Description

@fengyun2
  • Version: v9.8.0
  • Platform: windows10(64-bit)
  • Subsystem:
  • Browser: Chrome 62

http2

// server/index.js
// node 版本v9+ http2访问不成功,(启动不报错,但是在浏览器访问不到)
const http2 = require('http2')
const fs = require('fs')
const path = require('path')
const resolve = (dir) => path.join(__dirname, '..' , dir)
const options = {
  key: fs.readFileSync('privatekey.pem'),
  cert: fs.readFileSync('certification.pem')
}

 const http2App = http2.createServer(options, (req, res) => {
  res.writeHead(200)
  res.end('hello http2\n')
})

http2App.listen('8002', '0.0.0.0', () => {
  console.log('HTTP2 Server running at https://0.0.0.0');
})

Running node./server/index.js has no error, but access to the https://localhost:8002 failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions