Skip to main content

Testing localhost on windows mobile ios ios emulator iphone emulator virtual vm

For anyone who has struggled testing localhost on mobile devices or some other device than your dev machine Replace this snippet in your config/webpacker.yml

    host:  localhost
port: 3002
https: true

with

    host: <your ip>
port: 3002
https: true
public: <your ip>

Then you can access it anywhere with https://<your ip>:3000/

To get your ip ifconfig | grep broadcast result - 192.168.1.56 is your ip from the below result inet 192.168.1.56 netmask 0xffffff00 broadcast 192.168.1.255

What to do when your iOS / windows / etc instead of loading the page infinitely reloads with an SSL error?​

Problem: your device is not recognizing local SSL certificate for your ip:3002 as valid Solution: DON'T use https. Use http instead. To do this:

//in webpacker.yml set 
https: false
//in Procfile.dev  
//get rid of the --ssl option for thin web:
bundle exec thin start

If needed, remember to use http:// in /localdemo and in /powr_local.js

NOTE​

This also works in IE (internet explorer) and Edge on virtual box VM. However it seems you may need to first go to https://your ip:3002/ and approve the security exception and then load the page you want IN THE SAME TAB for it to work.