How to test a site hosted in a VM on your mobile device
I’m currently working on a .NET MVC site, while using a Mac. To make this happen, I installed Windows through Boot Camp. At first I would just boot into Windows and work like that, but then I needed access to Sketch files for the designs. So I needed to be running OS X. Since switching back and forth is not a good option, I looked into using my Boot Camp install as a VM. This turned out to be relatively simple and once I got that set up, I was able to work in the VM with Visual Studio, while still being able to access all my Mac programs. Just for fun, I also added a hosts file entry to my Mac, to allow me to access the .NET site in my OS X browsers.
But then came the point where I needed to test the site on mobile devices as well. I came across this blogpost, which described how to do that using Charles Proxy. But being the cheap-ass that I am, I didn’t want to pay money for this functionality. So I turned to Squid, the open source proxy. Installation was simple through Homebrew. Setup was a matter of running the SquidMan app. Because I have other stuff running on the default port of 8080, I changed that to 7777 and then I was ready to go.
On my mobile device, I set the proxy to my Mac’s ip address and the port to 7777. After that, I was able to just connect to the site running in the VM on my Mac.