Skip to content

Commit f8df94d

Browse files
committed
Clean up
1 parent 862f480 commit f8df94d

1 file changed

Lines changed: 5 additions & 25 deletions

File tree

‎index.js‎

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
const os = require('os');
22
const jwt = require('jsonwebtoken');
3-
const http = require('http')
4-
const https = require('https')
53
const http2express = require('http2-express');
64
const httpolyglot = require('@httptoolkit/httpolyglot');
75
const morgan = require('morgan');
@@ -208,31 +206,11 @@ app.all('/{*splat}', (req, res) => {
208206

209207
});
210208

211-
// let httpOpts = {
212-
// maxHeaderSize: maxHeaderSize
213-
// }
214-
215-
// let httpsOpts = {
216-
// key: require('fs').readFileSync(process.env.HTTPS_KEY_FILE || 'testpk.pem'),
217-
// cert: require('fs').readFileSync(process.env.HTTPS_CERT_FILE || 'fullchain.pem'),
218-
// maxHeaderSize: maxHeaderSize
219-
// };
220-
221-
// //Whether to enable the client certificate feature
222-
// if(process.env.MTLS_ENABLE){
223-
// httpsOpts = {
224-
// requestCert: true,
225-
// rejectUnauthorized: false,
226-
// ...httpsOpts
227-
// }
228-
// }
229-
230-
// var httpServer = http.createServer(httpOpts, app).listen(process.env.HTTP_PORT || 8080);
231-
// var httpsServer = https.createServer(httpsOpts,app).listen(process.env.HTTPS_PORT || 8443);
232209

233210
// plain text http server, http2 server (aka "h2c")
234211
var httpServer = httpolyglot.createServer({
235-
http: { maxHeaderSize: maxHeaderSize }
212+
http: { maxHeaderSize: maxHeaderSize },
213+
http2: {} // HTTP/2 in Node doesn't support max header size
236214
}, app).listen(process.env.HTTP_PORT || 8080);
237215

238216
let tlsOpts = {
@@ -250,9 +228,11 @@ if(process.env.MTLS_ENABLE){
250228
}
251229
}
252230

231+
// https server, http2 server (aka "h2")
253232
var httpsServer = httpolyglot.createServer({
254233
tls: tlsOpts,
255-
http: { maxHeaderSize: maxHeaderSize }
234+
http: { maxHeaderSize: maxHeaderSize },
235+
http2: {} // HTTP/2 in Node doesn't support max header size
256236
}, app).listen(process.env.HTTPS_PORT || 8443);
257237

258238
console.log(`Listening on ports ${process.env.HTTP_PORT || 8080} for http, and ${process.env.HTTPS_PORT || 8443} for https.`);

0 commit comments

Comments
 (0)