Can Easy Engine sites be accessed on a LAN


#1

I run EE on a dev machine connected to a LAN. Is it currently possible to access sites created via EE on the dev machine on other devices connected to the LAN?

I’m aware of ngrok but there’s too much latency for something like Browsersync to be effective for local dev and testing.


#2

When I’m making changes / updates / tests on sites, I would edit the hosts file on my local machines to point the domains to the IP of the dev server. The A records on the actual domain are still pointing to the live website that the public sees, but for me on my devices, my websites are being served to me from an entirely different server. If my ee sites were created with a wildcard cert (and verified via DNS challenge), HTTPS works without a problem even though I’m not being served by the real IP (A record) of the live website. Actually now that ee allows self signed certs, it would be even faster to just use those on your local dev server (for new websites you have not yet created).

It’s handy because this way any changes/updates I make on dev, I can restore on the live website without any issues about URL mismatches etc because it’s all the same.

So basically, my hosts file looks something like this

123.45.678.91       domain1.com
123.45.678.91       domain2.com
123.45.678.91       domain3.com
123.45.678.91       domain4.com
123.45.678.91       domain5.com

After editing the hosts file you need to clear the DNS cache on your machine (and browser). I use this method on my Windows/OS X machines. I don’t think you can do this on iOS devices, but you can easily do it on Android.

Ps. If this is something you need to do really often, since your dev machine is on your LAN, I’d recommend installing dnsmasq on it, I ended up doing that today. Really simple to install & use. Now I don’t need to edit the hosts file on each individual machine, just on the machine running dnsmasq. On all my devices both mobile and computers, I set the DNS servers to the local IP of my machine that is running dnsmasq. And now on every device I use, I am taken to my dev server instead of the live server. I ended up doing this because I really prefer to see how my sites look on mobile physically in-hand, and not via the inspector tool on desktop.

I know I could use staging sites/URLs but I’d rather not deal with database migrations and things like that. By modifying my hosts file I just make a backup, temporarily change my DNS back to my local router so I can visit the real/live website and then restore. All URL paths etc remain the same, no annoying problems to fix.


Opening Site On IP
#3

Thanks for that really useful reply!

I was not aware of this network feature - that ee sites are automatically available on the LAN via the hosts (dev machines) LAN IP. Very cool! I’m continuing to explore the nuts and bolds of EE. Do you know what Docker network routes requests from the host IP to the container? My docker network list command shows:

  • NETWORK ID NAME DRIVER SCOPE
  • 602c5e3a9e3e wpdev.local bridge local
  • 43fe794dbafd bridge bridge local
  • 5eff21818971 wpdev2.local bridge local
  • 7d213f8b4e94 ee-global-backend-network bridge local
  • 252d982f751e ee-global-frontend-network bridge local
  • bb3222a099d5 host host local
  • 32b9b72bd24f none null local

Thanks, I’m familiar with your method of using dnsmasq or manually editing /etc/hosts.


#4

Sorry I think I may have said something misunderstanding. The feature isn’t automatically available in EE. I just meant basically you can have your dev server and a live server, create your sites on both (with wildcard certificates issued to both servers.) — then you just use your hosts file to switch between live/dev, so when you want to see the dev site you would point the domain to your dev IP. Shouldn’t need to do any more config besides that.

Similar discussion in here for more info Opening Site On IP


#5

You were perfectly clear the first time :slight_smile: My question about networks was more for me wanting to understand the underlying docker network architecture of EE.