Exposing localhost to the internet

Give your local development server a public HTTPS URL in about a minute, and inspect every request that arrives through it.

Updated

Your API runs on 127.0.0.1 and something on the internet needs to reach it — a payment provider sending webhooks, a colleague reviewing a feature, a mobile app on real hardware. A tunnel gives that local server a public HTTPS address.

Start the tunnel

  1. Sign in to SchemaClient. Tunneling routes traffic through our servers, so unlike the REST client it needs an account.
  2. Open the Tunnel tab.
  3. Set the target to whatever your dev server is bound to:
http://127.0.0.1:8000
  1. Click Start Tunnel.
  2. Copy the public URL that appears — it looks like https://u1-a3f9.schemaclient.com.

Anything sent to that URL is forwarded to your local port, and the response travels back the same way.

Check it works

From any machine, or just a different network:

curl https://u1-a3f9.schemaclient.com/health

If that returns what http://127.0.0.1:8000/health returns locally, the tunnel is up.

When it does not work

  • 502 or connection refused — your local server is not actually running, or it is bound to a different port than the one you tunnelled.
  • Works locally, 404 through the tunnel — your framework is checking the Host header. Add the tunnel hostname to the allowed-hosts list. In Django that is ALLOWED_HOSTS; in Rails, config.hosts.
  • Assets break — the app is generating absolute http://localhost URLs somewhere. Look for a hardcoded base URL in the config.

Watch the traffic

The point of tunneling through an API client rather than a bare tunnel is that every request is captured. See monitoring API traffic for filtering and replay, or go straight to testing webhooks locally, which is what most people want a tunnel for in the first place.

Frequently asked questions

Is a localhost tunnel safe to leave running?

Treat the URL as public, because it is. Anyone who has it can reach your local server, so do not tunnel an app holding real production data, and stop the tunnel when you are done testing.

Why do I need an account for tunneling but not for the REST client?

The REST client runs entirely on your machine. A tunnel has to route traffic through our servers to give you a public hostname, so it needs an account to attach the tunnel to.