plugins: httpsServerOptions

Massimo Melina committed Feb 22, 2025 at 15:36 UTC 3f006cfa1f3f73ef9eeedf80f07f9d9f6dd8fefc
2 files changed +5 -2
dev-plugins.md
+3 -1
@@ -585,6 +585,8 @@ This section is still partially documented, and you may need to have a look at t
585 - `pluginUninstalled`
586 - `pluginStopped`
587 - `pluginStarted`
588 +- `httpsServerOptions` if you need to customize the options of the https server.
589 + - return: object with some properties [documented here](https://nodejs.org/api/https.html#httpscreateserveroptions-requestlistener).
590 - `uploadStart`
591 - parameters: { ctx, writeStream }
592 - preventable
@@ -778,7 +780,7 @@ If you want to override a text regardless of the language, use the special langu
780 ## API version history
781
782 - 12.0 (v0.57.0)
781 - - backend event: finalizingLogin
783 + - backend event: finalizingLogin, httpsServerOptions
784 - 11.6 (v0.56.0)
785 - api.setError
786 - frontend events: afterBreadcrumbs, afterFolderStats, afterFilter
src/listen.ts
+2 -1
@@ -101,8 +101,9 @@ const considerHttps = debounceAsync(async () => {
101 defaultBaseUrl.port = getCurrentPort(httpSrv) ?? 0
102 let port = httpsPortCfg.get()
103 try {
104 + const moreOptions = Object.assign({}, ...await events.emitAsync('httpsServerOptions') || [])
105 httpsSrv = Object.assign(
105 - https.createServer(port === PORT_DISABLED ? {} : { ...commonServerOptions, key: httpsOptions.private_key, cert: httpsOptions.cert }, app.callback()),
106 + https.createServer(port === PORT_DISABLED ? {} : { ...commonServerOptions, key: httpsOptions.private_key, cert: httpsOptions.cert, ...moreOptions }, app.callback()),
107 { name: 'https' },
108 commonServerAssign
109 )