diff --git a/src/NgrokProcessBuilder.php b/src/NgrokProcessBuilder.php index 4d844a1..5745281 100644 --- a/src/NgrokProcessBuilder.php +++ b/src/NgrokProcessBuilder.php @@ -52,6 +52,12 @@ public function buildProcess(string $host = '', string $port = '80') : Process { $command = ['ngrok', 'http', '--log', 'stdout']; + $region = env('NGROK_REGION'); + + if ($region) { + $command[] = "-region={$region}"; + } + if ($host !== '') { $command[] = '--host-header'; $command[] = $host; diff --git a/src/NgrokServiceProvider.php b/src/NgrokServiceProvider.php index 966ff1b..c7965a5 100644 --- a/src/NgrokServiceProvider.php +++ b/src/NgrokServiceProvider.php @@ -115,6 +115,6 @@ private function extractOriginalHost(Request $request) : string */ private function isNgrokHost(string $host) : bool { - return preg_match('/^[a-z0-9]+\.ngrok\.io$/i', $host); + return preg_match('/^[a-z0-9]+(?:\.[a-z]{2})?\.ngrok\.io$/i', $host); } }