diff --git a/src/config/types.ts b/src/config/types.ts index 3074cecab..139ca9e82 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -23,6 +23,7 @@ export type Source = { url: string; port: number; https?: { [x: string]: string }; + disableHsts?: boolean; mongodb: { host: string; port: number; diff --git a/src/server/index.ts b/src/server/index.ts index e9b2e2440..66a1d97d2 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -41,7 +41,7 @@ app.use(compress({ // HSTS // 6months (15552000sec) -if (config.url.startsWith('https')) { +if (config.url.startsWith('https') && !config.disableHsts) { app.use(async (ctx, next) => { ctx.set('strict-transport-security', 'max-age=15552000; preload'); await next();