egg-cluster
egg-cluster copied to clipboard
Support http2
Checklist
- [x]
npm test
passes - [x] tests and/or benchmarks are included
- [x] documentation is changed or added
- [x] commit message follows commit guidelines
Affected core subsystem(s)
Description of change
https://github.com/eggjs/egg/issues/898
只有在 https:true 的时候才会是 http2.createSecureServer,默认 http2:true 用的是 http2.createServer; 这个跟 http 一样的道理,我们建议用户使用 http,由代理来处理 https, 但还是支持用户直接使用 https
On 2018年4月25日 +0800 AM6:50, Guan Ce [email protected], wrote:
根据 https://blog.risingstack.com/node-js-10-lts-feature-breakdown/ 的建议 Most of the examples you’ll find will tell you that you should use http2.createSecureServer but as we discussed above, you should let your edge proxy handle that. ··· const http2 = require('http2'); const koa = require('koa'); const router = require('koa-route'); const fs = require('fs'); const app = koa(); app.use(router.get('/', function *(next) { this.body = 'Hello, World!'; yield next; })); http2 .createServer({}, app.callback()) .listen(3000, (err) => { if (err) { throw new Error(err); } console.log('Listening on port: 3000.'); }); ··· 注意用的是 http2.createServer 而不是 http2.createSecureServer — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I found that the ts unit test failed in ci. Is this PR affecting the ts? @atian25
Out of curiosity, does egg now support http2 (without nginx) or not? koa was perfectly able to run on http2. CCing @dead-horse @leaves4j