Allow option to disable sending HSTS headers even if https:// is used in url
This commit is contained in:
syuilo 2018-10-17 04:15:41 +09:00
parent 8f3bce6b11
commit 61f86dcb2b
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ export type Source = {
url: string;
port: number;
https?: { [x: string]: string };
disableHsts?: boolean;
mongodb: {
host: string;
port: number;

View File

@ -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();