Use the certs/ fallback in every environment

TLS no longer depends on NODE_ENV: the TLS_* variables win, else certs/
is used whenever it exists (the container's /app/certs mount lands there
too), and TLS_DISABLED=1 is the only way to serve plain HTTP with a
certificate present. The plain-HTTP redirect listener now starts whenever
TLS is on, not only in development, and HTTP_REDIRECT_PORT replaces
DEV_HTTP_PORT. The installer writes TLS_DISABLED=1 for --no-https, and the
health check follows the same rule.
This commit is contained in:
2026-10-20 10:29:37 +01:00
parent 8c20c9a7ed
commit 459eebf73d
10 changed files with 222 additions and 63 deletions
+7 -6
View File
@@ -8,18 +8,19 @@ type Params = {
};
/**
* Development convenience: a plain-HTTP listener on the port above the
* HTTPS one, which sends the browser to the same page over HTTPS.
* A plain-HTTP listener on the port above the HTTPS one, which sends the
* browser to the same page over HTTPS.
*
* A port that speaks TLS cannot answer plain HTTP, so this cannot sit on
* the HTTPS port itself: `http://<host>:<port>` still fails, but
* `http://<host>:<port + 1>` lands on the right page. `DEV_HTTP_PORT`
* picks another port. Production does not start it (only one port is
* published, and it is HTTPS).
* `http://<host>:<port + 1>` lands on the right page. `HTTP_REDIRECT_PORT`
* picks another port. Every environment starts it; the container publishes
* only the HTTPS port, so there it is reachable only if that second port is
* published too.
*/
export default function startHttpRedirect({ https_port }: Params) {
const base = Number(https_port);
const configured = Number(process.env.DEV_HTTP_PORT);
const configured = Number(process.env.HTTP_REDIRECT_PORT);
const redirect_port =
Number.isInteger(configured) && configured > 0
? configured