@@ -30,6 +30,7 @@ class StartFrankenPhpCommand extends Command implements SignalableCommandInterfa
3030 {--max-requests=500 : The number of requests to process before reloading the server}
3131 {--caddyfile= : The path to the FrankenPHP Caddyfile file}
3232 {--https : Enable HTTPS, HTTP/2, and HTTP/3, and automatically generate and renew certificates}
33+ {--http-redirect : Enable HTTP to HTTPS redirection (only enabled if --https is passed)}
3334 {--watch : Automatically reload the server when the application is modified}
3435 {--poll : Use file system polling while watching in order to watch files over a network}
3536 {--log-level= : Log messages at or above the specified log level} ' ;
@@ -75,7 +76,9 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
7576 $ host = $ this ->option ('host ' );
7677 $ port = $ this ->getPort ();
7778
78- $ serverName = $ this ->option ('https ' )
79+ $ https = $ this ->option ('https ' );
80+
81+ $ serverName = $ https
7982 ? "https:// $ host: $ port "
8083 : "http://: $ port " ;
8184
@@ -90,6 +93,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
9093 'LARAVEL_OCTANE ' => 1 ,
9194 'MAX_REQUESTS ' => $ this ->option ('max-requests ' ),
9295 'REQUEST_MAX_EXECUTION_TIME ' => $ this ->maxExecutionTime (),
96+ 'CADDY_GLOBAL_OPTIONS ' => ($ https && $ this ->option ('http-redirect ' )) ? '' : 'auto_https disable_redirects ' ,
9397 'CADDY_SERVER_ADMIN_PORT ' => $ this ->adminPort (),
9498 'CADDY_SERVER_LOG_LEVEL ' => $ this ->option ('log-level ' ) ?: (app ()->environment ('local ' ) ? 'INFO ' : 'WARN ' ),
9599 'CADDY_SERVER_LOGGER ' => 'json ' ,
0 commit comments