Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to get ngrok working with Craft CMS during development
<?php
// When using:
// `ngrok http -host-header=example.dev 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,
),
],
// ...
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment