egg-cluster icon indicating copy to clipboard operation
egg-cluster copied to clipboard

Support http2

Open leaves4j opened this issue 6 years ago • 4 comments

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

leaves4j avatar Apr 24 '18 09:04 leaves4j

https://github.com/eggjs/egg/issues/898

leaves4j avatar Apr 24 '18 09:04 leaves4j

只有在 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.

leaves4j avatar Apr 25 '18 02:04 leaves4j

I found that the ts unit test failed in ci. Is this PR affecting the ts? @atian25

leaves4j avatar Apr 25 '18 02:04 leaves4j

Out of curiosity, does egg now support http2 (without nginx) or not? koa was perfectly able to run on http2. CCing @dead-horse @leaves4j

po35 avatar Aug 01 '19 11:08 po35