While working on one of the sites, I was facing responsive issues on mobile devices. It was annoying to deploy smaller changes to check on the actual device.
So I was looking for some tool/solution using which I could check the changes done on a local site immediately on the mobile device.
I was using Lando on my local. So I searched for making Lando’s local site accessible on mobile devices within the same network.
I found that there is a command, lando share, using which we can share our local site not only on the same network but over other networks as well (to your client too). But it is no longer functional though you can sponsor to make it functional again.
I continued searching if there was any other alternative solution, and found one. Please go through the explanation below for detailed steps.
Make changes to access your site on mobile devices in the same network
First, we will need to change the bindAddress in the config.yml file. This file specifies the core configuration options for Lando. And it has nothing to do with your .lando.yml file. (Changing the Bind)
Then run the lando config command to check the location of the config.yml file on your machine.
Open the config.yml in your desired code editor. Initially, this file will be blank, with just opening and closing curly brackets.
Then add the following code in the same file and save it.
Go to your project directory and run the lando rebuild command so that these changes will take effect.
After running lando rebuild, this file will look like this:
As soon as you are done with it, find your IPv4 address.
Links to find your private IP address (IPv4 address)
Mac: How to Find Your IP Address on a Mac
Linux: How to Find your IP Address in Linux
Windows: How to Find an IP Address in Command Prompt or Find your IP address in Windows
Access your site on the devices connected on the same network with: https://<ip_address>:<port_number>
So, if your IP address is 198.168.0.1 and your site’s port address is 59061, then hit the following URL in your device’s browser: https://198.168.0.1:59061
Here's a screenshot of my local Lando site:
Desktop
iPhone and iPad
Remove the bindAddress from config after use to avoid any security issues.
Here is a link for quick Drupal site installation guide using Lando: Getting Started
Other References:
By following the steps mentioned above, you can access your local Lando site on any device within the same network with a few changes in the Lando's config file.