How-to guides
Expose a web app or API
Give a running local web service an HTTPS URL, including services in Docker.
Use this guide when an app or API already listens on an HTTP or HTTPS address. Femtoport gives it a public HTTPS URL and forwards requests through an agent that can reach the app. The app must keep running; Femtoport does not start it for you.
Create and connect the tunnel
- Start the app and check its address from the machine that will run the agent. For example, open
http://127.0.0.1:3000there. Use your app's actual port and protocol. - Sign in to the dashboard. You need a workspace with credit and an active entitlement to serve traffic. If prompted about credit, the workspace owner can use Free trial if available, redeem a code, or buy credit under Credit and billing.
- In Tunnels, select Create new tunnel, choose Web app or API, and enter the reachable address in Target URL, such as
http://127.0.0.1:3000. Select Create tunnel. - In Agent token, copy the token and keep it private. The app is public when the agent connects unless it already has its own access controls. To require a tunnel login first, close the dialog, open the tunnel's settings, enable Require basic auth under Basic auth, and add a username and strong password.
- On the machine that can reach the app, run the command for your system below, replacing
YOUR_AGENT_TOKENwith the token from the dashboard. You can instead copy the filled-in Run in this folder command under Linux/macOS or Windows in the token dialog. The command downloads the agent into the current folder and runs it in the foreground; keep the terminal open. Linux/macOS:
Windows PowerShell:curl -fsSL https://cdn.femtoport.com/run.sh | sh -s -- --token='YOUR_AGENT_TOKEN'$ProgressPreference = 'SilentlyContinue' $p=Join-Path (Get-Location) 'femtoport-run.ps1' Invoke-WebRequest -UseBasicParsing https://cdn.femtoport.com/run.ps1 -OutFile $p & $p -Token 'YOUR_AGENT_TOKEN' - Wait for the tunnel to show Online, then open its public HTTPS URL from the dashboard. Check that the app works, including sign-in and any links you plan to share. For background operation, the token dialog offers Install as a service. It also offers Install the femtoport CLI for a per-user foreground command.
The agent token is a secret: anyone with it can run an agent for this tunnel. Do not paste the command into a public chat or commit it to a repository. If it is exposed, revoke it under Agent tokens and create a new one.
Protect the app
The URL is public by default. Anyone who has it can reach the app, so use the app's own authentication and access controls. To add a tunnel login, open the tunnel's settings, turn on Require basic auth under Basic auth, and add a user with a strong password. Test the public URL in a separate browser session before sharing it. A URL alone is not a password.
Run the agent alongside a Docker app
If the app runs in Docker Compose, the agent can join the same Compose project. Follow the creation and protection steps above through step 4, but set Target URL to the app's Compose service name and its internal listening port, for example http://immich-server:2283 for an Immich service with that name and port. localhost inside the agent container refers to the agent container, not the app or host.
In the Agent token dialog, open Docker / docker-compose and copy the docker-compose service into your Compose file alongside the app. If you closed the dialog to set Basic auth, use the copied token below or reveal it again under Agent tokens with the emailed verification code. Alternatively, add this service under the existing services: key and replace YOUR_AGENT_TOKEN with this tunnel's token:
femtoport-agent:
image: registry.femtoport.com/agent:2
restart: unless-stopped
environment:
FEMTOPORT_AGENT_TOKEN: "YOUR_AGENT_TOKEN"
In the directory containing the Compose file, run:
docker compose up -d femtoport-agent
Wait for Online in the dashboard and open the tunnel HTTPS URL to test the app. Keep the Compose file private because the snippet contains the agent token. When the agent and app share a Compose network, the service name resolves there. For an app on the Docker host, the dashboard suggests http://host.docker.internal:<port> and an extra_hosts entry mapping host.docker.internal to host-gateway; the app must listen on an address the container can reach. To update the image, run docker compose pull followed by docker compose up -d.
If the URL does not work
- Waiting for agent means no agent is connected. Check that the correct token's agent is running and has internet access. An Online agent alone does not prove the app is reachable.
- Check the target from the agent's own network, including the scheme and port. A container's network is different from the host's. Make sure the app is still running and accepts connections from the agent.
- Check Tunnel enabled, workspace credit and entitlement in the dashboard. An exhausted or expired allowance can prevent traffic.
- Some apps need their own public URL, trusted-host, or proxy settings adjusted; use the app's settings and test its full login and navigation flow.
To pause access, open the tunnel settings and switch off Tunnel enabled. Turn it back on to resume, or delete the tunnel when finished. For a first walkthrough, see Create your first tunnel.