Laravel - Using ngrok uses wrong routes

July 30, 2020 - 1 min read

When using ngrok to tunnel connections to Laravel, Laravel keeps using the internal hostname (i.e. laravel.localhost or similar) instead of the ngrok URL to build routes, even though you’ve added the ngrok URL to .env in APP_URL. You can overcome this by telling Laravel to force the given root URL by adding this to your app\Providers\AppServiceProvider.php;

public function boot() {

Kyle Mathews

Written by Peter Jaap Blaakmeer @PeterJaap