Skip to content

Commit

Permalink
Adds support for ngrok region
Browse files Browse the repository at this point in the history
  • Loading branch information
cathrinevaage committed May 4, 2021
1 parent e5edae8 commit 2757321
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/NgrokProcessBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/NgrokServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 2757321

Please sign in to comment.