Creating a local VPN Tunnel

Hi, i'm working on an iOS app that starts a HTTP Server when it loads. This server runs on localhost (port 8081). When the app is running, other computers on the same network are able to access this webserver.

Furthermore, all of the devices on are connected to the iPhone personal hotspot, so network traffic is actually going through the device.

The problem is that some devices on the local network block any local network connections. So, for example 127.0.0.1:8081 to access the server running on the iPhone will be blocked.

I'm trying to find a way around it, and I saw that some people were able to get around this problem by using a local VPN Tunnel or Local Proxy to basically allow routing some host from a connected device over to the server running on 127.0.01:8081

I've looked into the following APIs NEAppProxyProvider but I'm not how to essentially intercept all traffic and route traffic to 127.0.0.1:8081 based on rules.

Some examples would be helpful.

What is your high-level goal here?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

So the problem I'm having is outlined in the visual here. In summary:

  • I have an http server running in an app, and servers connections on a port
  • The Web client, in this case is restricted to any connection on localhost, so even though the client is on the same network, the device the web client is running on blocks localhost connection.
  • The HTTP server that runs inside iOS app will always be in the foreground as its not meant to be long-running
  • Finally, both the iOS device and external device are on the same network fir a personal hotspot from iOS device

What I'm trying to do (some people have done something similar from what I can tell), is to setup a VPN on the device to tunnel the HTTP server to the device. Something like this. I'm not sure if this is the correct approach to achieve what I want to achieve. I'm open to suggestions.

I can’t think of any supported way to implement this. At a minimum I’m not comfortable endorsing anything that relies on Personal Hotspot. See my explanation as to why in this post.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Creating a local VPN Tunnel
 
 
Q