Make Laravel Homestead Available Over the Internet

How can I make Laravel Homestead (Vagrant vm) available over the internet? Currently, I have set up my router to forward to the local IP address of my host machine. However, this causes the Laravel site to think that all incoming requests come from 10.0.2.2.

What would be the correct way to make a website accessible over the Internet? Should I force the VM to assign the DHCP router IP address? If so, how do you do it?

+3


source to share


3 answers


The correct answer these days would be to use the Homestead alias share

on the command line via ssh.

eg. share acme.app



It uses ngrok behind the scenes and is documented in the Laravel Documentation .

0


source


You can make it work with the xip.io service . More details here: http://christoph-rumpel.com/2014/10/access-laravel-homestead-projects-through-other-devices-in-three-little-steps/



0


source


You most likely need to tell Laravel to trust the router as a proxy:

Request::setTrustedProxies([
    '10.0.2.2',
]);

      

This will work if the router sets the header types correctly X-Forwarded-For

.

0


source







All Articles