Search code examples
ruby-on-railsvirtual-machinewebrick

Accessing rails application running on VM


I have a rails application running on a linux VM at localhost:3000 which I can happily access. However, when I try to access the app outwith the VM (Windows) I get ERR_SSL_PROTOCOL_ERROR in Chrome.

The rails server outputs:

ERROR bad URI
ERROR bad Request-Line 

How am I able to configure my rails app so I can access it outwith the VM.

I am using ruby 2.1.5, rails 4.1.7 and WEBrick 1.3.1.

Thanks


Solution

  • The vm uses a different localhost than your computer. Try:

     http://10.0.2.2:3000 
    

    Don't forget to write http!! If that does not work, you will have to go to C:\windows\system32\drivers\etc\hosts and add:

    10.0.2.2 outer