Back to Blog
Development4 min read

Give an App on Your Laptop a Real HTTPS Address (One That Doesn't Change)

DT
DomainDock Team
Engineering ·

There's a point in most projects where localhost:3000 isn't enough. Stripe wants a public HTTPS URL to send webhooks to. A client wants to click through the prototype before you deploy anything. You want to see the site on your actual phone, not in a resized browser window.

The usual answer is a tunnel. Here's what one does, how to run one with DomainDock and the two mistakes that turn a convenient tunnel into an open door.

How a tunnel gets around your router

Your laptop can't normally accept connections from the internet. Your router doesn't forward them, many internet providers put several customers behind one shared address (CGNAT). Office networks block incoming traffic on purpose.

A tunnel flips the direction. A small program, the agent, runs on your laptop and opens a connection out to a server on the internet, the way your browser does. That server has the public address. When a visitor arrives, it sends the request down the connection your agent already opened, the agent passes it to your app and the answer goes back the same way.

Nothing has to be opened on your router. If your laptop can browse the web, it can run a tunnel.

The address is the part that matters

Many quick tunnels give you a random address. Some hand you a new one every time you restart them. That's fine for a five-minute demo. It's painful for webhooks: every restart means updating the URL in Stripe's dashboard, GitHub's settings or your OAuth app.

With DomainDock the tunnel is a domain like any other, so its address stays put. Today demo.digitalweb.host reaches your laptop. Next month you deploy to a VPS and change the target on the same domain. Nothing your visitors or webhook providers use has changed.

Running one

Create the domain and choose On my computer:

  1. In your project, click Add domain.
  2. Pick the address, choose On my computer and click Create tunnel.
  3. Copy the command on the next screen. It contains your agent token, which is shown once.

The agent is frp, an open-source tunnel that's been around for years. Download frpc for your system, then run the command with the port your app listens on:

frpc http -s tunnel.digitalweb.host -P 443 -p wss -l 3000 \
  -d demo.digitalweb.host -n demo.digitalweb.host \
  --metadatas token=<your-token>

If you'd rather not download anything, the dashboard gives you the same thing as a Docker command. On Docker Desktop it reaches your app through host.docker.internal:

docker run --rm fatedier/frpc:v0.72.0 http -s tunnel.digitalweb.host -P 443 -p wss \
  -i host.docker.internal -l 3000 \
  -d demo.digitalweb.host -n demo.digitalweb.host \
  --metadatas token=<your-token>

The tunnel panel with the agent status and the command to runThe domain's Overview shows whether the agent is connected and the command to start it.

The agent connects over HTTPS on port 443, the same as a browser, so it gets through firewalls that only allow web traffic. Within a few seconds the dashboard shows Agent connected and https://demo.digitalweb.host serves your app.

Your app receives each request with your DomainDock address as the host and X-Forwarded-Proto: https, so frameworks that insist on HTTPS (for secure cookies or redirects) behave the same as in production. WebSockets work, so hot reload and live dashboards are fine.

When the laptop closes

Stop the agent, close the lid or lose Wi-Fi: visitors get a page saying the tunnel is offline instead of a timeout. Start the agent again and the site is back, same address.

If the site has to stay up while you're away, add a backup server on the domain: a hosted copy that answers while your laptop doesn't.

Two ways to leave the door open

A tunnel puts something that runs on your laptop on the public internet. That's the point. It's also worth a minute of thought.

The token is the key. Anyone with it can run an agent and serve their own content at your address. Don't paste the command into a public repo, a screenshot or a shared doc. If it leaks, replace the token from the dashboard: the old one stops working immediately.

Whatever you tunnel is public. A dev server often has a debug page, an admin panel with default credentials or an API with no auth, because it was only ever meant for localhost. The moment it's tunnelled, anyone who finds the address can reach all of it. For a client demo, turn on password protection on the domain; for webhooks, check the provider's signature in your handler.

What it doesn't do

DomainDock tunnels carry HTTP and HTTPS only. You can't tunnel a database port, SSH or a game server. Each tunnel serves one address, so two local apps need two tunnels and two agents. And there are no down alerts for tunnels, since closing your laptop isn't an outage.

The tunnel guide walks through every option on the setup screen. Testing webhooks? This post covers the signature and retry bugs you'll meet first. For a summary of what you get for free, see free domain for localhost. If you're choosing between tools, our comparison with ngrok and Cloudflare Tunnel covers where each one fits.

tunnellocalhostwebhooksfrphttps
Newsletter

Developer infrastructure, in your inbox

New guides on domains, SSL certificates and deploying to your own server. A couple of emails a month at most.

No spam. Every email has a one-click unsubscribe.