Set a local-target timeout
Tune how long JustTunnel waits for your local server to respond before failing a request.
You want to change how long JustTunnel will wait on your local server per request. Maybe you have a slow image-processing endpoint that needs a generous window, or maybe you'd rather fail fast on a hung backend instead of holding the connection.
The CLI exposes this as --local-timeout, accepting a Go-style duration (5s, 30s, 1m, 2m30s). The default is 30s, which fits most web apps comfortably.
Steps
1. Decide what you're optimizing for
| Situation | Recommended --local-timeout |
|---|---|
| Default web app, REST API | 30s (the default — leave it alone) |
| Slow data export / report generation | 2m to 5m |
| File uploads from clients | Match your largest expected upload time, plus headroom |
| Local server that occasionally hangs (you want fast failure) | 5s to 10s |
2. Pass --local-timeout to the tunnel
justtunnel 3000 --local-timeout 5s
Or for a long-running upload endpoint:
justtunnel 8080 --local-timeout 5m
3. Combine with other flags as needed
--local-timeout is independent of subdomain reservation, password protection, or context — pair it with whatever else you need:
justtunnel 8080 --subdomain acme-uploads --password 'preview-2026' --local-timeout 5m
Verify
Pick a value much shorter than your local server's response time and confirm the tunnel returns a 504-class error promptly. For example, against a local server that delays responses by 10 seconds:
justtunnel 3000 --local-timeout 2s
In another shell:
time curl -i https://wandering-otter-42.justtunnel.dev/slow-endpoint
The request should fail in roughly 2 seconds with an upstream timeout error, not 10. Reset to the default and it'll succeed:
justtunnel 3000 # back to 30s default
Common issues
- Timeouts too short for legitimate work. If users see frequent timeouts on a slow endpoint, raise the value —
1m,2m, etc. The CLI accepts any Go duration string; spaces are not allowed (30snot30 s). - Timeouts mask local bugs. A very long timeout will hide a hung backend until users complain. Pair long timeouts with monitoring on the local service so you notice hangs early.
- Worker tunnels. Worker tunnels do not currently honor
--local-timeout— they're a pure WebSocket attach loop, with no per-HTTP-request forwarding to time out. The flag is only meaningful onjusttunnel <port>ad-hoc tunnels.
Related
justtunnel [port]— root command, including--local-timeout.- Tunnel anatomy — how requests flow from edge to local server.
- Tunnel keeps disconnecting — different failure mode (the WebSocket itself dropping).