I'm running a Nginx Web server on my Linux system and I would like to access it on my iPhone (Safari or through my iOS app) when I connect it through USB cable.
How can I do it? is there any available solution?
Having iPhone and Linux system in a same network and access through its iP is not a solution here.
You can use ngrok.
Here is a step-by-step guide:
Download ngrok (https://ngrok.com/download) and move executable to /usr/bin/.
Register here and copy your auth token.
Open the terminal (Ctrl+Alt+T or Ctrl+Alt+F3) and type:
cd
ngrok authtoken <YOUR_AUTHTOKEN>
ngrok http 80
It will give you some URL address. Open it on your iPhone.
Your home page will be shown.
More info on ngrok: https://ngrok.com/docs/secure-tunnels
Related
I need some help accessing a server that I have running on my mac. So basically my setup consists of mac on which I'm running my server and also using XCode to run the app on an iPhone connected via USB. And then both this iPhone and the mac are on the same wiFi network which is a personal hotspot that I have running on a different iPhone. I'm trying to access localhost from the iPhone by basically using my mac's IP address and the right port: http://IPADDRESS:PORT/, however this doesn't seem to work. Any ideas as to what may be going on here and potential workarounds or solutions. Connecting to a non hotspot, traditional wifi network is not an option at the moment.
Thanks!
This will work if you have it set up correctly; I am doing it right now. Remember that you have to bind the server to 0.0.0.0 — not 127.0.0.1 — if you want to connect from non-localhost IPs. Also check your system firewall.
If you're still having trouble, Tailscale is another solution that may help — https://tailscale.com
I suggest you take a look at using ngrok as a solution, this will create a secure tunnel and expose the service running on your Mac through a url.
You'll need to create an account and retrieve your auth token.
You can then install it using Homebrew by running in Terminal: brew cask install ngrok
Once installed, connect your account by typing into Terminal: ngrok authtoken [auth_token]
To start a tunnel, type into Terminal: ngrok [protocol] [port number]
For example, to start a tunnel to a HTTP server running on your mac: ngrok http 80 (or ngrok http 443 for HTTPS)
If its a custom TCP protocol use: ngrok tcp [port] (or ngrok tls [port] if using TLS)
This will then give you a URL to use in your app. On free accounts, the URL will change on each restart, paid accounts get a static URL option.
If you don't have Homebrew, download it from and follow instructions on: https://ngrok.com/download
I have a server running on localhost:5000 on my desktop, and when I make http requests through my react-native app when running on the iOS simulation to it, it works. However, when I connect to a real device, the http requests don't work. What am I doing wrong? Is there something I have to configure?
localhost in your desktop is not the same ip of the localhost of your device.
Get the ip of your computer by typing ifconfig in a terminal, then replace localhost by this ip, you should type something like that in your device browser:
192.168.0.23:5000
Maybe my answer is too late but I ran into a similar situation today and I got it to work by running my node server using the IPv4 of my desktop and then making the request to that IP.
For example, I am running my nodejs development server at http://192.168.0.135:3000(local IP of my desktop) instead of localhost and then I make the fetch API request from my react-native app to http://192.168.0.135:3000/.
Just make sure your nodejs server and your app are on the same local network. My react-native server (metro bundler) is running on a separate PC also in the same wifi network.
If your are on macOS go to settings -> Wifi / and show more,
on bottom you see "IP address", it's your correct localhost for ios physical device !
I'm using Blink on my iPad Pro to SSH to my DigitalOcean Ubuntu web server and run Jupyter Notebook.
I can SSH just fine, and can run Jupyter Notebook fine as well. I get the usual Jupyter Notebook url http://localhost:8888/?token-12345 but when copy-pasting this url in my chrome browser on my iPad, I get he error message 'this site can't be reached'.
Anyone knows how to fix that? Is SSH tunnelling part of the solution? What command(s) should I run?
There are multiple ways to do that:
SSH tunnel / port forwarding. You may need a standalone app to establish a tunnel (this one, for example), and then connect to your server in browser using localhost and mapped port.
Public server. You can make your server accessible publicly (more details here), but beware that you may also need to configure a valid SSL certificate to connect to your server via HTTPS, or otherwise Jupyter's kernel will not be able to connect in any iOS browser. Here is a step-by-step guide on how to configure a self-signed certificate that will work on iPad: https://juno.sh/ssl-self-signed-cert/
Finally, once you get it working in Chrome/Safari, you may consider using an app that I've developed instead of browser, it's called Juno and it's a Jupyter Notebook client for iPad: https://itunes.apple.com/app/juno-jupyter-notebook-client/id1315744137
It does require an in-app purchase to connect to an arbitrary server, but you can launch a bunch of introductory notebooks for free out of the box, without any configuration.
I have a web application written in ASP.NET MVC 5. I simply can open it from the browser with this localhost:14920 in my computer, but I want to access the same application from my Android device's browser while my laptop and Android device are in the same network. I don't know how to access it from Android.
Note: when I type 127.0.0.1 in the Android browser I can access the IIS server, but when I type 127.0.0.1:14920 it prints Bad Request - Invalid Hostname. How can I fix this issue?
You can configure IISExpress for remote access
http://www.ryadel.com/en/iis-express-allow-external-requests-remote-clients-devices/
or just change the hosting to IIS as the earlier commenter mentioned.
Try with replacing 127.0.0.1 with your IPv4 address.
I have used ngrok in the past, when needing to hit my development machine, or have someone else hit it. It is a very useful tool and very simple to install.
Once you download it, it's just a simple command line:
https://ngrok.com/docs#expose
ngrok http 80
(That is for traffic on port 80) Since your port above looks different it would be:
ngrok http 14920
That will give a URL that you can hit or any machine or device.
I have a iOS app that I am building in Visual Studio 2015 with Xamarin. I also have a Web Application with an Api, no authorisation. But when I try to connect to the api I get an error saying "Connection Refused".
I call the api through the following code:
var client = new HttpClient();
var data = await client.GetAsync("http://localhost:7074/api/values/get");
Config your Web API with an IP Address, say local 192.168.x.x
And replace localhost by that IP
var data = await client.GetAsync("http://191.268.x.x:7074/api/values/get");
localhost will point to your iOS device/emulator, not the server. You need to specify the IP or FQDN in the url. Also be be sure the firewall is open and that IIS is setup to accept remote connections.
localhost is your iPhone / iPad or simulator (the device where you run your app). You have to change it to the IP/Domain of your server.
If the server is your dev machine, ensure, that your phone is connected to the same network (e.g. via WiFi), else you might have the same problem, because your dev machine might not be reachable.
You can find the IP of your dev machine by typing ipconfig | find "IPv4" into the console (on Windows).