I am using ngrok to port-forward a website hosted locally on my machine. The website was built using Laravel, Vue and PHP. When I access it locally (http://127.0.0.1:8000/
) everything works well.
When I run ngrok (ngrok.exe http 8000
), I can access it from my local machine using the new link, but not from other machines. On the other devices, it seems that it loads the header of the website but nothing else.
This is the ngrok link: https://e342-2001-56a-fa70-ee00-cde7-f078-3936-5705.ngrok-free.app
2
Answers
try to use this library instead laravel-ngrok
To configure ngrok with your Laravel application for local development, follow these steps:
Open the
AppServiceProvider.php
file located in your Laravel project.Add the following code inside the
boot
method of theAppServiceProvider
class:Open your terminal and run the following command, replacing
laravel-site.test
with the local URL your Laravel app uses:ngrok will provide you with a forwarding URL, typically in the format
abc123.ngrok.io
. Add the following line and replace abc123.ngrok.io with the URL you received from ngrok in the.env
file:Clear your app’s cache using the following commands in the terminal:
For more: https://vanrossum.dev/5-using-ngrok-with-laravel