Friday, March 30, 2018

Setup that helped me test Apple Pay (on the web) from my iPhone

Problem:

I am working on integrating Apple Pay with Oracle Commerce for one of my clients. Understanding all the stuff about ApplePayJS and setting things up and making it work was one of the problems, even though Apple has a rich community and people are more than willing to respond. We always hit one road block which no one has come across and its always a trial and error to fix it. Ok now to the problem. My development was on a CentOS Linux VirtualBox VM on a Windows Machine and my testing was from an iPhone6 I own, as my MacBook was not the latest touch enabled one. The issue is iPhone doesnt allow you to edit the hosts file and there is no way to access the Vhost of the apache inside the linux VM. I tried to read a lot about this issue, and most of the solutions were just not working for me. So here is what I did.


Solution:

I was able to access local.eshop.com (assume thats my vhosts inside the Linux VM) from the Windows box by mapping it on the windows hosts file. I have also enabled http/https (80/443) port redirect configurations on the VirtualBox VM. I couldnt add DNS records on my WIFI router for the vhosts so my iPhone can understand it. So I managed to install the WProxy on my Windows box and started it and configured it to route http traffic. I connected my iPhone and Windows machine to the same WIFI (I had just one) and used the settings option for the WIFI to edit the proxy information. Here I specified the proxy details of WProxy which I started earlier on the Windows box. Now I was successfully able to access the website which was configured to run on a vhosts inside a Virtual box linux VM. There is also one another problem that has been solved by this setup. My client has dev and stage environments which are accessible over VPN but the domain isnt on the VPN DNS, so we used to have hosts entries for those as well on our windows box. Due to the necessity of this host entries it was impossible to access the dev and stage sites on apple devices. This issue is also now solved.

WProxy URL - http://imfirewall.us/WProxy.htm