Is it possible to set a localhost IP for iPhone? - ios

The use case is that we are testing a site that runs on a local machine.
I know how to access the site (How do you access a website running on localhost from iPhone browser), but there are redirects to "localhost".
Is there any way to set localhost to an IP address on iPhone?

localhost is a loopback address. So you cannot access a website hosted on iPhone or any device remotely using 127.0.0.1. You would just access the site using the whatever IP address was assigned by DHCP.
Yes, you can set the IP Address of the Wi-Fi connection under Settings --> WiFi.

Well, the IP address for localhost is 127.0.0.1 but you can't access your phone's localhost because it's not an Apache server? You can only access your app's directory eg. Documents.
And Apple doesn't allow you to access your iPhone's root folder, if you wanted to access this.
If you want to view websites from another computer's localhost you need to use that machine's internal IP address (eg. 192.168.0.1) if you are on the same WiFi/LAN network.

Related

how to bind IP address to a domain name?

we currently have a completed rails app and are looking to deploy on a local secured network. To have all devices on secured network access the site I bound my IP address with
bundle exec rails server --binding= <ip-address>
It works perfectly however we don't want to release the IP address of the computer running the app so how can I set an ip dress t o a host name? Thanks

Is there a way to get the iOS simulator to access a FQDN redirecting to my localhost?

I am running a local web server with SSL enabled that my app needs to log into. I have a domain name whose A-record is set to 127.0.0.1, which allows for local development using loopback with an nginx server with different subdomain configurations for services on the app I have hosted locally. The problem is that, in the iOS simulator, the domain resolves to the device's localhost and not my machine. I can't use the IP address of my machine because I need the domain for nginx to redirect to the proper vhost (also SSL and OAUTH would get mad).
Is there any way to use a custom DNS server for lookup in the simulator? Either that, or can I edit the hosts file to set the domain to my device's LAN IP instead of localhost? Any other ideas?

Is there a workaround to configure host to address mapping on hosts file on iPad?

I need to connect to a work remote server via work VPN (the server is web GUI so connection is via https) which requires hosts resolution, meaning I have to configure the host name and map to the IP address in the hosts file. This is how I connect to the remote server on my Mac.
I just got a new iPad 2020 and I will like to connect to the server on my iPad.
For me to access the hosts file on iPad, I will have to jailbreak of which I don’t wanna do that. I’ve read counts of articles online on how to go about using some other apps, but it only works for if your server and your device are both on thesame network and VPN is not used.
Appreciate if there is a workaround for me to do this:
I need to connect via work VPN;
Access the server using the host name on safari etc.
Thanks.

Test Website on Local Network

I'm a web developer that's not very savvy when it comes to networking. I have a web site that is on my local machine. I've setup the website so that it is currently running on my local IIS. I can access the website while doing development by putting http://localhost:11000/ into the address bar of my browser. Now, I want to test my website on a tablet.
My tablet and my local development machine are on the same network. I confirmed they are hitting the same router. When I ask Google what my IP address is, it returns the same address for both my development machine and on my tablet. When I enter [ipAddress]:11000 into the browser on my tablet, it works for a while and then returns nothing. The browser just says:
"Safari could not open the page because the server stopped responding."
My question is, how do I test a website from my local development machine on my tablet? Are there IIS settings I need to change? If so, what settings?
Thank you!
iis ipad
I would use the command window and enter ipconfig to discover the ip address of your dev machine. Then use that IP address on your remote machine (ipad). The IP address you are getting that is the same between your workstation and your ipad is likely your router's address. but each of your devices has an address of its own; you need the workstation's IP address to connect to its IIS instance.
A similar question was answered previously at:
How to access your website through LAN in ASP.NET

How do you host a Ruby on Rails application on a local network, so multiple people can access it?

I'm brand new to RoR and have pretty much 0 experience with it. I have been handed down somebody else's project and I need to find a way to host the application, so people can just access it locally. The application is a spider script/walker script/web scraper whatever you call it. Basically it connects to a website, logs in, retrieves certain data each day and maps it with the previous data. While on the local machine, you use it, go to localhost:3000, and you get the webpage the previous person designed. I was just wondering how I could get that page to be public for the people on our local network, so they could connect to some arbitrary IP and see the same page (it updates daily)?
What I tried doing is making the folder containing the application public to the network, but in order to use it, I would have to make everybody on the network allowed to write to it and each person would have to install RoR to use it. I want to avoid that since it doesn't seem logical, nor is it what I'm trying to do.
Looking at the code, I can reverse engineer and understand what it does, but when it comes to hosting web apps locally or something of that sort, I have never done this before. Please help!
Thanks in advance!
**EDIT
-This is all being done on a Windows 7 machine.
Since you're on Windows, open up a command line and run ipconfig to find out your local IP. It will be listed under 'IP Address'.
Tell people in your LAN to access http://192.168.x.x:3000 replacing 192.168.x.x by your IP address from step 1.
EDIT: One major thing that I missed, you are windows. On windows u could use thin and put it behind a load balancer. Although i would suggest hosting it on a UNIX machine :)
Although Running it in webrick(webrick is the application server for development i.e when u run rails s) will let other users access the website NEVER do the same for a production application. If you want to run this application in production, u need more powerful application servers like passenger. I would suggest you use it with Apache or Nginx instead of stand alone passenger. Once all this is setup others can use your application by entering the IP(xx.xx.xx.xx) also u can ask your system admin to setup a local DNS so your users need not remember the IP address always.
Description:
While starting Rails Server, we can also setup some options to configure the IP address and also the port number of the site under development environment to host the website in local network. So if we want to change the IP from http://127.0.0.1:3000 to http://192.168.x.x:port (x= 0 to 255 any one number), we can set that in Rails server command! But for this, we will need to find out our current IP address at our current network which will help us to serve the website in local network.
So at first step:
We will open our terminal on our PC. For Android user, we need to open Termux app. Then simply type ifconfig to get the IP address of our device in the current network. We will get an output like this one (Here I'm using Android device for development. So output might be something different than this one on your PC terminal but the process is same):
$ ifconfig
Warning: cannot open /proc/net/dev (Permission denied). Limited output.
lo: flags=XX<UP,LOOPBACK,RUNNING> mtu XXXXX
inet 127.0.0.1 netmask 255.XXX.XXX.XXX
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen XXXX (UNSPEC)
wlan0: flags=XXXX<UP,BROADCAST,RUNNING,MULTICAST> mtu XXXX
inet 192.168.1.103 netmask 255.XXX.XXX.XXX broadcast 192.168.1.255
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen XXXX (UNSPEC)
X= some numbers with our device credentials which is dummied with this variable
If you are using a WiFi router then we will need the wlan0 part to get our device IP. Under wlan0 section there is a subsection of inet showing our current IP! YUP, we need that IP address 192.168.1.103! This might be different for your device and network. This is the key of this mission! Now we're going to the second important step.
So the Second Step is:
That required input command to configure the IP address.
rails s -b 192.168.1.103 -p 8080
Here:
rails s for rails server
-b 192.168.1.103 for bidding the IP address for customisation from the default IP http://127.0.0.1 which is our localhost address.
-p 8080 for port setup. This part is optional. Default port is 3000.
This is the process of changing the localhost IP (http://127.0.0.1) to local network IP which will be available for other device of the same network user.
Now our rails app is available in our local network! Other users in the same network will also be able to visit the website while the server command is running. And the link will be http://192.168.1.103:8080 if you also configure the port number. Otherwise if you have used the command rails s -b 192.168.1.103 without port configuration the link will be: http://192.168.1.103:3000
Again: 192.168.1.103 was for my case, your IP address will be different for your device. That will be needed to use for your server and link address.

Resources