-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Description
- 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
Labels
No labels