QuickTools
PadProxy icon with its iPhone and iPad screens
Apps23 Nov 20267 min read

My work VPN lives on my iPad, so I made the iPad a proxy for my Mac

The story of PadProxy: an app that turns an iPad or iPhone into a proxy so a Mac can use its VPN connection. The prompts, the ssh trick, and what went wrong.

9M4ckBy 9M4ck · Beginner

Here is the situation. My work VPN is connected on my iPad, but the machine that needs to reach internal websites and servers is my MacBook. The fix I had Claude Code build is to make the iPad a go-between and have the Mac route through it.

The result is PadProxy. It runs a small proxy on the iPad. A Mac on the same network sends its traffic through it, and that traffic leaves through the VPN the iPad is already using.

PadProxy on iPhone with the proxy running
PadProxy on iPhone shows the address to copy
PadProxy on iPad next to the Mac setup steps
On iPad, the Mac setup steps sit beside it
Status As I write this, I cannot find PadProxy on the App Store, so there is no download link yet. There is a website for the app. If it goes live I will add the link here.

The rules I set in the first message

The prompt I gave Claude Code is one long English text, in one go (I pasted it, I did not type it live). The most important line was: do not use NetworkExtension or any VPN API. If the app touched the VPN layer, it might knock my work connection offline. So it had to be a plain user-space socket server that accepts connections from other devices on the same network. Use Apple's own Network.framework, no outside libraries, and support CONNECT so HTTPS can pass through.

What I find interesting is that the prompt gives the reason with the rule, not just the rule: "no VPN APIs because this must run beside a live VPN." A reason like that helps the AI make the other choices in the app consistently.

Same afternoon: onto the iPad

I typed "deploy to my ipad" and connected the Mac. The web browser worked, but ssh in the terminal still could not reach my work server. The terminal ignores the macOS system proxy and tries to go straight out through my home internet. You have to tell ssh to use the proxy yourself with ProxyCommand:

ssh -o "ProxyCommand nc -X connect -x [ipad-ip]:8080 %h %p" [user]@[server]

With that it connected, and I followed up with "ok it work now deploy it to my iphone17 pro also" so I could run it on the phone too.

Real use, and the app fixing its own problem

Two days later an internal web page on a work server would not open. I let Claude ssh in through this very app and look. The server's firewall was not allowing the VPN's address range on some ports. It added allow rules for five ports and the page opened. I like that a tool an AI built was then used by the same AI to fix something real. (I am not writing the server's password here, and if I did it again I would use an ssh key instead of giving a password in a command.)

From a tool for me to something fit for the store

On 21 October I asked for the store-ready pieces: an icon, a tip jar (coffee $0.99, lunch $4.99, dinner $9.99, nothing unlocked), iPhone support, and keeping the silent audio loop that stops iOS from suspending the app in the background for debug builds only. The App Store build does not include it.

Two days after that I added a companion app for the Mac, PadProxyMac, which lives in the menu bar. The iPad announces itself over Bonjour so the Mac finds it by itself, and one click turns the macOS system proxy on or off, so I do not have to open System Settings every time.

Made with AI. Claude Code wrote the code. I set the constraints, tested against my real VPN and servers, and decided what to keep.

The prompts I really used

The first one is the long English prompt I pasted in one piece. I did not trim it, because every point has a reason. Use it as is if you have a similar situation. The last section of it mentions Info.plist settings, and they matter, because without them the app cannot accept connections from the Mac.

1. The starting prompt (20 Oct)

You are an expert iOS/iPadOS developer. Build a complete, production-ready native iPadOS app in Swift and SwiftUI that acts as a local HTTP and HTTPS (CONNECT) proxy server.

### Critical Architecture Constraints
1. DO NOT use NetworkExtension, NEPacketTunnelProvider, or any VPN APIs. The app must run strictly as a user-space socket server so that it can run concurrently alongside an active GlobalProtect VPN tunnel without terminating it.
2. Use Apple's native `Network.framework` (`NWListener` and `NWConnection`) without third-party dependencies.
3. Support HTTP proxy requests and the HTTP `CONNECT` method (essential for tunneling HTTPS / SSL traffic between the client and destination).

### Requirements

#### 1. Core Proxy Engine (Network.framework)
- Implement a `ProxyServer` class using `NWListener` listening on `0.0.0.0` (default port `8080`, configurable).
- When an incoming connection arrives from the LAN (MacBook):
  - Read the HTTP request header.
  - If the method is `CONNECT host:port HTTP/1.1`:
    - Establish an outbound `NWConnection` to the target `host:port`.
    - Once connected, send `HTTP/1.1 200 Connection Established\r\n\r\n` back to the client.
    - Enter bidirectional raw TCP streaming (forward bytes from client to target, and target to client) until either side closes.
  - If the method is standard HTTP (`GET`, `POST`, etc.):
    - Parse the absolute URI from the request line, establish the outbound connection, forward the original request, and stream the response back.
- Implement robust error handling, socket teardown, and cancellation when connections drop.

#### 2. Local IP Address Detection
- Provide a utility to query the active network interface (`en0` / Wi-Fi or `pdp_ip0` / Hotspot) using `getifaddrs` in Swift to display the iPad's current local IPv4 address (e.g., `192.168.1.X` or `172.20.10.1`).

#### 3. SwiftUI Interface
- Clean, iPad-friendly dashboard showing:
  - Server Status (Running / Stopped indicator with an animated badge).
  - iPad Local IP address (with a "Copy" button).
  - Port input field (default `8080`).
  - Big Start / Stop toggle button.
  - Active Connections Counter and live connection log view (method, host, status).
  - Clear instructions block showing the user what to type into their MacBook Proxy Settings.

#### 4. Background & Permissions Configuration
- Specify all required entries for `Info.plist`:
  - `NSLocalNetworkUsageDescription` (required by iOS 14+ to accept incoming connections over Wi-Fi).
  - Background Execution capabilities (e.g., Audio keepalive or idle-timer disabling via `UIApplication.shared.isIdleTimerDisabled = true`) to prevent iOS from suspending the socket server while running in the background.

Please provide the complete, compilable Swift code organized cleanly into classes, and explain how to set it up in Xcode.

2. Install it

deploy to my ipad

3. It works, install on the second device

ok it work now deploy it to my iphone17 pro also

4. Let the AI fix a server through this proxy (22 Oct)

why i cannot open web http://[server-ip]:9000/[path]
how to fix it you can ssh to check config on this server by ssh -o "ProxyCommand nc -X connect -x [ipad-ip]:8080 %h %p" [user]@[server-ip]
One thing to take away A prompt that opens with a role, then lists the don'ts with the reason for each, works for other projects too. Write two or three rules with their reasons and see how much better the AI decides everything else.
9M4ck

About the author

Hi, I'm 9M4ck, a dad who loves trying new tech, especially AI that you can talk to in plain words and that builds something useful. I don't write code myself. I started Jubmue AI (จับมือ AI) because friends kept asking me to walk them through the things I made at home, like the family TV setup.

The photos and screenshots here are from my own TV, phone and projects. The videos and voice-overs on my Facebook page are made with AI tools. This blog adapts the written steps from my posts, so you can follow along at your own pace.

Follow along: Facebook · YouTube · TikTok

Keep reading