File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,12 @@ export async function bootstrap() {
1717 app . enableShutdownHooks ( ) ;
1818 app . useGlobalFilters ( new SpaFallbackFilter ( ) ) ;
1919
20+ const betterAuthUrl = process . env [ 'BETTER_AUTH_URL' ] || '' ;
21+ const hstsEnabled = / ^ h t t p s : \/ \/ / i. test ( betterAuthUrl ) ;
22+
2023 app . use (
2124 helmet ( {
25+ hsts : hstsEnabled ,
2226 contentSecurityPolicy : {
2327 directives : {
2428 defaultSrc : [ "'self'" ] ,
@@ -34,6 +38,10 @@ export async function bootstrap() {
3438 . map ( ( v ) => v . trim ( ) )
3539 . filter ( ( v ) => v !== '*' )
3640 : [ "'none'" ] ,
41+ // Helmet ships `upgrade-insecure-requests` in its defaults. Safari enforces it
42+ // even on loopback (Chrome/Firefox skip for localhost), which rewrites every
43+ // same-origin subresource to https:// and breaks plain-HTTP dev/Docker setups.
44+ upgradeInsecureRequests : null ,
3745 } ,
3846 } ,
3947 } ) ,
You can’t perform that action at this time.
0 commit comments