iPhone Dev with Desktop's LocalHost

From my iPhone, I would like to be able to type in my IP address of my desktop where a self-hosting version of ghost resides. The desktop is listening on port 2368 with a loopback address of 127.0.0.1. Do I have to modify the config.development.json to “listen on all address”? I am surprised it didn’t work by entering in http://computer_name.local:2368. Any assistance would be appreciated.

I just figured this out. Set host to 0.0.0.0 within the config.development.json file. This will tell the desktop’s network interface to listen for ALL IP addresses that attempt to access http://IP_desktop:2368. So now any device on the same network as the desktop can access Ghost dev.

Update:
The problem is that the root domain is still localhost:2368. When I go to IP_desktop:2368, I can access the homepage from iPhone. If I click on links that have a file path, e.g., http://localhost/file_name, then I am able to navigate to different pages. But if I click on the homepage which has a root domain of localhost, then iPhone interprets that as 127.0.0.1. From the perspective of iPhone, this loopback is not setup. There must be a better way to accomplish this. I will take a look at ngrok.

There is no solution that I can think of since we have to use a url of localhost. This will of course cause any client to interpret that to mean its own localhost, which is not where the server is running.

So I tried ngrok’s solution. It works like a charm. It allows you to expose your localhost easily to not only local clients but to the internet as well. The config.development.json file will have to be edited as follows.

Notice how the url is no longer https://localhost:2368. This will allow clients other than the server to access your site. Ngrok forwards any request made to the url below to your localhost of 127.0.0.1.

{
  "url": "https://subdomain-given-to-you.ngrok-free.app/",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  }