Can't reach backend server via localhost on iPhone/iOS - ios

I am testing a full-stack React app on my iPhone, which is configured with the frontend running on port 3000 and the server on port 8080. I know that to access the localhost from your iPhone, you find the IP address of your computer and replace "localhost" with the IP in your mobile Safari, appending port 3000. However, this only brings me to my login screen. From there, when trying to log in to the app, it is sending a request to "localhost:8080/login", and I'm getting a Network Error in response.
How can I fix this so I can log into the app on localhost and test mobile features on my iPhone?

Related

connecting xamarin form with local web server

The backend of the application I am working with is running on docker. and the port is open on localhost:80. I am trying to connect xamarin form android apps ( android emulator) with the backend.
So i am confused about the backend IP address. will it be the host IP or docker ip?

How send POST request to a localhost from mobile device?

I'm trying to implement a login in react native + flask app. I have a docker container for my server API. I've run it on my localhost in my computer. I'm also running my front-end on expo. Since it's a different host, how can i send POST request from my mobile device (expo) to the server running on localhost in my computer?
Docker server runs in port 5000 in container. I've mapped the local port 5000 to container's 5000 port.
First of all I hope you are exposing the correct server ports in the docker container.
Then, it can be easily done by using you local machine IP address in your home network instead of "localhost". Maybe your Firewall settings must be changed.
For React I usually save the server IP in an .env, so for production I can easily switch the server

How can I access my local development server over the internet?

I have Wamp 3.1.7 running on a Windows 10 machine. The goal is to have the projects on this server accessible via the internet.
The server is available and working as expected over LAN when accessed with the LAN IP, e.g.
http://10.0.0.3/.
The server runs behind my router, which has its web interface running on port 80, so when I access my public IP, traffic on port 80 goes to the router login page.
Steps taken to try and solve the issue:
change the port my server is listening to from 80 to 8080. (this is working, both locally and over LAN, accessed with http://10.0.0.3:8080)
Add inbound rules on windows firewall for port 8080, set to allow all.
Add port forwarding on the router settings (forward incoming traffic on port 8080 to local IP 10.0.0.3:8080 as per https://portforward.com/d-link/dsl-g2562dg/)
Using PFPortChecker, it says that port 8080 on public_ip is open and able to send data.
I remain unable to access my server. When I go to public_ip:8080, I get ERR_CONNECTION_TIMED_OUT.
As stated above, going to public_ip just displays the router login page.
So as far as I can tell: port 8080 is open, my server is accessible over LAN on port 8080.
What am I missing? Where else could my traffic be blocked?
Stupid mistake on my side.
Answer found here: Public IP Web Page "Connection Timed Out" When Connected To
The issue was that you cannot access the server with the public_ip if connected the LAN the server is running on.

No access to a rails server running behind a firewall

I am trying to run a ror application at a friend's home and the application is not reachable from the outside. Here is what we have tried.
The application has been created with
$ rails new <application name>
and started with
$ rails server
The development server starts and is reachable on http://localhost:3000
Next thing we have activated port forwarding on the router he uses to connect to the internet: we have mapped the external port 3000 to port 3000 on the internal host on which the rails server is running. When I try to open the page from the outside (with firefox) I get an error page: unable to conenct to host, the host may be down, try to connect later.
Things we have tried:
Changed port forwarding 80 -> 80
Installed and started Apache: the default Apache page is reachable.
Stopped Apache and started the rails server on port 80 (with sudo, otherwise it can't use port 80): the rails server is not reachable.
I have also checked the firewall of the machine running the rails server. The OS is ubuntu 12.04: the firewall (at least ufw) is not active. I can also connect to that machine using port 22 / ssh.
Summarizing:
rails server is accessible on port 3000 on local host
port forwarding works for ports 22 and 80 and both ssh server and apache server are reachable
rails server is NOT reachable on both port 80 and 3000 from the outside
The only thing I can think of is that rails might have a mechanism similar to Django's ALLOWED_HOSTS and that it refuses external requests because they are for a different host than localhost. However, I haven't found anything on this topic. Also, the application's log files do not show any connection attempt that was refused by the rails server.
So we are out of ideas. What should we check next?
Prior to Rails 4.2, the default for rails server was to bind to all interfaces. In Rails 4.2 this changed to only bind to 127.0.0.1 by default - there's nothing in the application logs because the socket is simply not listening to connection on other network interfaces.
To allow connections from another machine you need to use the -b option to bind to extra ip addresses, eg
rails s -b 0.0.0.0
to bind to all available ip addresses. You can of course replace 0.0.0.0 with one of your machine's actual ip addresses although you would of course have to change that invocation whenever your machine's ip address changed.

External access to home Rails server

My home server is running on Raspberry Pi with Rasbian (Debian for ARM)
There rails server is running: rvmsudo rails s -b ${LOCAL_IP} -p 80
It works perfectly fine to access from local machines, but it is not working when I am trying to access from outside of my local network
It should not be a router problem as I can easily access that server over ssh (both :22 and :80 are open in router preferences)
If you can access http via your local network ip, then it can be issue with router, look to port forwarding settings of DMZ.
BTW, router can use 80 port for its own purposes, like web interface. Try to bind to 8080 port for example.
As an alternative to share 80 port via internet you can use https://ngrok.com/
It allows you to share localhost http to anyone.

Resources