trust proxy

This commit is contained in:
Grant 2024-05-22 16:53:53 -06:00
parent 12d1347a06
commit d8a66b7d45
1 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import { setupAllProviders } from "./lib/delivery/index.js"; import { setupAllProviders } from "./lib/delivery/index.js";
import { app as Express } from "./lib/express.js"; import { app as Express } from "./lib/express.js";
import { oidc } from "./lib/oidc.js";
if (typeof process.env.SESSION_SECRET !== "string") { if (typeof process.env.SESSION_SECRET !== "string") {
throw new Error("SESSION_SECRET is not defined"); throw new Error("SESSION_SECRET is not defined");
@ -32,6 +33,11 @@ if (process.env.NODE_ENV === "production") {
if (typeof process.env.OIDC_COOKIE_KEYS_FILE !== "string") { if (typeof process.env.OIDC_COOKIE_KEYS_FILE !== "string") {
throw new Error("OIDC_COOKIE_KEYS_FILE is not defined"); throw new Error("OIDC_COOKIE_KEYS_FILE is not defined");
} }
if (!process.env.USE_INSECURE) {
oidc.proxy = true;
Express.enable("trust proxy");
}
} }
setupAllProviders().then((providers) => { setupAllProviders().then((providers) => {