File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export class Entry extends Command {
2525 port : flags . integer ( { char : "p" , default : 8443 , description : "Port to bind on" } ) ,
2626 version : flags . version ( { char : "v" } ) ,
2727 "no-auth" : flags . boolean ( { default : false } ) ,
28+ "allow-http" : flags . boolean ( { default : false } ) ,
2829
2930 // Dev flags
3031 "bootstrap-fork" : flags . string ( { hidden : true } ) ,
@@ -134,6 +135,7 @@ export class Entry extends Command {
134135 const password = "023450wf0951" ;
135136 const hasCustomHttps = certData && certKeyData ;
136137 const app = await createApp ( {
138+ allowHttp : flags [ "allow-http" ] ,
137139 bypassAuth : flags [ "no-auth" ] ,
138140 registerMiddleware : ( app ) : void => {
139141 app . use ( ( req , res , next ) => {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ interface CreateAppOptions {
2626 serverOptions ?: ServerOptions ;
2727 password ?: string ;
2828 httpsOptions ?: https . ServerOptions ;
29+ allowHttp ?: boolean ;
2930 bypassAuth ?: boolean ;
3031}
3132
@@ -187,7 +188,7 @@ export const createApp = async (options: CreateAppOptions): Promise<{
187188 const authStaticFunc = expressStaticGzip ( path . join ( baseDir , "build/web/auth" ) ) ;
188189 const unauthStaticFunc = expressStaticGzip ( path . join ( baseDir , "build/web/unauth" ) ) ;
189190 app . use ( ( req , res , next ) => {
190- if ( ! isEncrypted ( req . socket ) ) {
191+ if ( ! isEncrypted ( req . socket ) && ! options . allowHttp ) {
191192 return res . redirect ( 301 , `https://${ req . headers . host ! } ${ req . path } ` ) ;
192193 }
193194
You can’t perform that action at this time.
0 commit comments