connect expose command makes a local service accessible to your teammates through the Private Connect hub.
Usage
Arguments
Target to expose in the format
host:port (e.g., localhost:3306 or 192.168.1.10:8080)Options
Service name that teammates will use to connect
Hub server URL
API key for authentication (if not already configured)
Protocol:
tcp, udp, http, or httpsCreate a public URL accessible from anywhere (HTTP/HTTPS services only)
Automatically create a shareable public link
Link expiration time (e.g., “1h”, “24h”, “7d”)
Enable debug mode with live traffic inspection
Enable AI copilot for debug sessions
Path to custom config file
Examples
Expose a Database
Expose with Public URL
Expose with Auto-Link
Expose UDP Service
Expose with Debug Mode
Behavior
Service Registration
When you expose a service:- The CLI registers the service with the hub
- A tunnel is established via WebSocket
- The hub assigns a unique tunnel port
- Diagnostic checks run automatically
Protocol Detection
Common ports are automatically detected:- Port
5432→postgres - Port
3306→mysql - Port
6379→redis - Port
27017→mongodb - Port
3000→web
Public URLs
The--public flag creates a publicly accessible URL for HTTP/HTTPS services.
Automatic Reconnection
The agent automatically reconnects if:- Network connection drops
- Hub server restarts
- WebSocket timeout occurs
HTTP Request Handling
For public HTTP services, requests are proxied through WebSocket:- Hub receives HTTP request
- Request forwarded to agent via WebSocket
- Agent proxies to local service
- Response sent back through WebSocket
- Hub returns response to client
Diagnostics
After exposing a service, automatic diagnostics check:- DNS: Name resolution
- TCP: Port connectivity
- TLS: Certificate validation (if HTTPS)
- HTTP: Health check (if HTTP/HTTPS)
- Latency: Round-trip time
Exit Codes
0- Service exposed successfully (when stopped with Ctrl+C)1- Registration failed, network error, or invalid target
Related Commands
connect reach- Access exposed servicesconnect up- Start agent before exposingconnect share- Share entire environment
Troubleshooting
Service Unreachable
If diagnostics showUNREACHABLE:
- The service is running:
curl localhost:3000 - Port number is correct
- No firewall blocking local connections
Port Conflicts
If the target port is wrong:API Key Required
If you haven’t authenticated:connect up first to authenticate.