Skip to content

Instantly share code, notes, and snippets.

@Tam Tam/craft-ngrok.php
Created Jun 27, 2017

What would you like to do?
How to get ngrok working with Craft CMS during development
// When using:
// `ngrok http 80`
$isNgrok = array_key_exists("HTTP_X_ORIGINAL_HOST", $_SERVER) && strpos($_SERVER["HTTP_X_ORIGINAL_HOST"], "ngrok");
$host = 'http://' . $_SERVER[$isNgrok ? 'HTTP_X_ORIGINAL_HOST' : 'SERVER_NAME'] . '/';
return array(
// ...
'.dev' => [
'devMode' => true,
'siteUrl' => $host,
'environmentVariables' => array(
'baseUrl' => $host,
// ...

This comment has been minimized.

Copy link

commented Feb 23, 2019

I have tried this so many times, but it just does not do it for me. The links created by the entry does not consider the, and tries to connect to the dev server directly. And the admin login page does not work properly, it does not respond to me pressing the login button. I can however type in manually the entry url with the, and it shows me the pages I want.
I use homestead, not sure if that can have anything to do with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.