I Have 2 applications:
rails s
Well, the apps are not talking yet...
I'm trying to perform a POST
to http://192.168.1.34:3000/api/uploads
from the device, but I'm getting ERR_CONNECTION_REFUSED
on chrome.
So, I try to execute the same request from the computer and it returns the same ERR_CONNECTION_REFUSED
.
When I execute http://localhost:3000/api/uploads
, from the computer it works fine.
So, I think the local ip is not mapping to localhost. How can I do this?
I' using:
OSX El Capitan 10.11.1
Google Chorem Version 48.0.2564.23 beta (64-bit)
this is how my /etc/hosts
file looks like:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 leansmac
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
ping it's working too:
ping 192.168.1.34
PING 192.168.1.34 (192.168.1.34): 56 data bytes
64 bytes from 192.168.1.34: icmp_seq=0 ttl=64 time=0.091 ms
64 bytes from 192.168.1.34: icmp_seq=1 ttl=64 time=0.070 ms
64 bytes from 192.168.1.34: icmp_seq=2 ttl=64 time=0.138 ms
the mac and the phone are connected to the same wifi
I think it's an issue with Rails not accepting connections from outside except localhost.
Please try the following :
Allow public connections to local Ruby on Rails Development Server
The simplest way requires no additional installations: just add a single option to your rails server (or rails s) command when you start up the server:
rails s --binding=0.0.0.0
The 0.0.0.0 address means "listen to requests from anywhere." On many systems, the default is 127.0.0.1, which means "listen to requests from localhost only." (If you don't also specify a -p or --port option, then the port shall be 3000, as usual.)