Developing React Native on Device When Ports are Blocked - ios

I developing a mobile application using React Native. For testing, I run the application on a physical iPhone which means pointing the device to the React Native server running on port 8081 of my laptop. As a remote developer, I often work in coffee shops, libraries, or other public places with WiFi.
My issue is some of these public places block traffic between devices so even if the phone and development machine are on the same network, the mobile device is unable to reach the React Native server.
One remedy I have found is to create a private network between the iPhone and my Macbook. While this solved the issue of connecting to the React Native server, it cuts my laptop off from a public internet connection so this is not a viable option.
Is there a solution to this problem which retains a public internet connection for my devices and also allows comunication between the phone and the React server?

https://ngrok.com allows you to setup secure tunnels to localhost that you can access on the public internet.
Test mobile apps against a development backend running on your
machine. Point ngrok at your local dev server and then configure your
app to use the ngrok URL. It won't change, even when you change
networks.

Related

NextJS does not load on iPhone using cellular connection

I have built a production NextJS (v11.1) web-app with React (v17.0.2). I then compiled a Docker (v20.10.8) image on an Apple MacBook Air M1 using buildx to ensure compatibility with amd64 processors. I then deployed the image to AWS EC2 on Ubuntu 20.04 with an x86_64 processor. I am also using Node (v14.17.5), Apollo Client (v3.4.8), GraphQL (v15.5.1) and finally NGINX (v1.18.0) as a reverse proxy server.
The image successfully deployed. I can visit my webpage on a laptop (macOS Big Sur v11.5.2) over WiFi, on an iPhone (iOS v14.7.1) over WiFi, and on Android phones with either WiFi or a cellular connection. Unfortunately, I cannot visit my webpage on an iPhone over cellular connection. I was hoping that connecting to the webpage on my laptop, but through the iPhone's hotspot feature would provide more insight. However, the page failed to load and I still didn't see much useful information.
To the best of my knowledge each technology is using the latest, stable version. Does anyone know why a NextJS web-app would fail to load specifically on an iPhone using a cellular connection? Or even have additional insight into how I might debug this issue?
Yes. The problem was that I had disabled NGINX support for IPv6, while I had forgotten to disable IPv6 support in Route 53 / AWS. I chose to disable IPv6 and the issue is resolved.

Cannot load site on localhost with iOS devices on BrowserStack Automate

I'm hosting a .NET Core HTTP application on localhost using Kestrel on an available port for some browser-based UI tests, but when trying to access it using real iOS devices with BrowserStack Automate with BrowserStackLocal.exe, Safari consistently refuses load the page.
I've tried various parts of the IP ranges documented here, but none have been successful. Desktop browsers (Chrome, IE, Edge and Firefox on Windows, Safari on macOS Mojave) and real Android devices work as expected.
I've also tried using the local IP address of the machine and the fully-qualified domain name (FQDN) as described here, but neither work portably as Windows Firewall blocks the connections even through BrowserStack Automate can resolve the address.
Port 80 is not a viable solution as developers' machines will have IIS running on their machines using that port, so it is not available for other purposes.
Given the following constraints, what are the workable solutions?
Hosted on HTTP.
Runs without admin privileges (i.e. no reconfiguring the firewall or using privileged port numbers <1024).
At least two possible port numbers to use so that if one is in use there's at least one alternate to try.
No additional manual setup required to run the tests (should just be the command dotnet test).
On the iOS devices, try resolving http://bs-local.com:5000 instead of http://localhost:5000.
You can access the site using http://bs-local.com:5000, But make sure to disable the host check for webpack using disableHostCheck: true in configuration.
For angular cli users, to disable to the host check you need to use --disable-host-check like ng serve --port 4200 --disable-host-check
This is from BrowserStack's support:
a) On Safari
Previously, accessing local websites with 'localhost/127.0.0.1' in the URL was not supported on iOS devices running iOS versions 10 and above.
However, to make sure that your website loads with 'localhost' in the URL, we now modify the URL to http://bs-local.com on these devices. This helps in loading your website in an expected manner. The same is mentioned here.
In the screenshot you've shared, you can see the redirection to bs-local.com as well.
It seems that your localhost website is configured to be accessible only via specific hostnames such as 'localhost'. Thus, you face the reported error.
To be able to test your localhost website via Safari on iOS devices, I would recommend configuring your localhost website to be accessible via the private IP address of your local machine.
Once done, you can access your localhost website as http://<private_IP_address:port> and this should work.
I would also encourage reading through this guide to understand how you could achieve the above: https://www.notion.so/Testing-localhost-on-iOS-devices-1ceb5e274cee46d7ac538b71304919b4
b) On Chrome
Due to restrictions imposed by Safari, testing localhost websites on Chrome is not supported by default on iOS devices.
The problem arises with the usage of the domain 'localhost'. We are actively trying to find alternatives for this behavior as well.
However, in the meantime, you can access your localhost website via the private IP address as mentioned above via Chrome browser on iOS devices as well.
Once you make the necessary changes to your configuration to allow your localhost website to be accessible via the private IP address, you can test your localhost website via Chrome on iOS as well.
Feel free to reach out should you need any further assistance!
Note: The private IP address is not the same as 127.0.0.1. You can use this article to identify the private IP address of your machine.
Regards,
Reehan
BrowserStack Support
Did you try changing the 'localhost' with the IP address of the machine (where the web is hosted)?
For instance - If the IP for the machine on which application/webpage is hosted is 22.22.22.22, then change http://localhost:3000/index.html to http://22.22.22.22:3000/index.html in your test
They have mentioned the same here - https://www.browserstack.com/question/663
If you are using Angular CLI then please run command
ng serve --host 0.0.0.0 --port xxxx
This will make sure that you would be able to access application using your IP and port specified. Once done you should be able to access your application using browser stack iPhone device browsers using IP and port rather than localhost.

Test XCode app running on physical device with local server

I have searched high and low for a solution to this which I am sure must exist but I have failed to find one that works.
I am running XCode 7.3 and iOS 9.2 on an iPhone.
I have a test server running on 127.0.0.1:8000
I cannot get my app running on the iPhone to connect to either 127.0.0.1:8000 or 192.168.1.200:8000 (which is the local ip address of my server).
There must be a way to give the iPhone app access to the local server if only I knew how!
The best solution to this problem, that many app developers have, is to download ngrok which acts as a proxy website.
ngrok is insanely easy to use:
Download from https://ngrok.com/
Run: ngrok http 8000 in terminal (where 8000 is your port)
Cut and paste the displayed ngrok url (e.g. http://a021v2tc.ngrok.io) into your app
So simple. And works!
Check if iPhone connect the same wifi with your server.
You can use Fiddler as iPhone agent to get the detail error message.
There is the link how to capture traffic from IOS device.
here

How can I make a PyCharm server running locally available to iPhone on same network

I am developing a backend server for an app using PyCharm. This runs on my laptop as 127.0.0.1:8000
I need to access this server for testing from an iPhone. This is connected by wifi to my local network to which the laptop is also connected.
I have tried entering http://mycomputer.local:8000 in safari on the iPhone but I get the message "Safari could not open the page because the server stopped working. I am using the real name of my computer instead of 'mycomputer'.
I am running OS X Yosemite so Web Sharing is not available in System Preferences.
How can I give access to the 127.0.0.1:8000 server to my iPhone?
When you say "backend server", what is the Python project written in? Django, Flask, Pyramid, something else?

How to force Xcode server connections over SSL

The Issue:
Connecting to the Xcode server CI web interface over SSL with a provisioned iPad and attempting to download an integrated build fails with a message that it cannot connect.
The Setup:
I've just set up Mac OS X Server 3.01 on my home iMac OS X 10.9 (Mavericks) for continuous integration. In the server admin panel only Xcode and File Sharing services are turned on. I've got continuous integration working from my MacBook Pro dev machine, configuring and running integration bots from the web UI served by the Xcode server on the iMac.
I want team members to have access to the CI web interface so I'm serving from the iMac to a public dynDNS address, port-mapped through from the Airport Extreme router to the iMac. This all works, but I want to force connecting only over SSL.
I did originally enable the Websites service in the server admin and created a redirect rule, configured with Source: "/", Destination: "https://myServer.dynDNSName.org", Status: "Permanent (301)". This did work to force all requests to port 443 and logging in worked as expected. When logging in to the CI interface with iPad Safari over SSL it is possible to navigate to the various bots results pages as expected. The problem is, tapping a built product link to download onto the provisioned iPad fails with the message, "Cannot connect to myServer.dynDNSName.org".
I have since turned off the server Websites service which once again allows connection over port 80. I don't want to allow clear text logins over port 80 because login accounts are server user accounts. My current workaround is to log in over SSL, then change the URL on the iPad to http://myServer.dynDNSName.org, to download the product, which then does install on the device.
So the question is, how can I set up the iMac server to not allow insecure logins and still enable downloading integrated products to devices?

Resources