Suga provides two networking modes: Private Networking for internal service communication, and Public Networking for exposing services to the internet.Documentation Index
Fetch the complete documentation index at: https://docs.suga.app/llms.txt
Use this file to discover all available pages before exploring further.
Networking Overview
| Type | Purpose | Configuration | Security |
|---|---|---|---|
| Private | Service-to-service communication | Automatic | Internal only |
| Public HTTPS | Web traffic with TLS | Port 443 | Automatic TLS |
| Public TCP | Non-HTTP protocols | Custom port | No TLS by default |
Private Networking (Service Discovery)
All services in the same environment can communicate privately using automatic service discovery. Private traffic stays inside the environment and is never exposed to the internet.How It Works
Automatic DNS:- Every service gets an internal hostname
- Internal DNS resolves service hostnames to addresses within the environment
- No manual configuration required
- PostgreSQL:
postgres:5432 - Redis:
redis:6379 - API service:
api:3000 - WebSocket server:
websocket:8080
Configuring Hostname and Ports
Each service has a Private Networking section in its Config tab where you can set:- Hostname: the name other services use to reach this service. Defaults to the service identifier. Override it to use a friendlier name like
postgresorapi. Hostnames must be unique within an environment. - Ports: the ports this service listens on internally. Add every port you want reachable from other services in the same environment.
Connection Strings
Use service names in connection strings:Private networking currently only works within the same environment. Services in “production” cannot reach services in “staging”.
Public Networking
Public networking exposes services to the internet. Suga offers two modes: HTTPS and TCP Proxy.HTTPS Endpoints
HTTPS endpoints provide secure web access with automatic TLS certificates. All HTTPS traffic goes through Cloudflare’s global CDN. Features:- Port 443 (HTTPS)
- Automatic TLS certificates via Cloudflare
- Cloudflare CDN, WAF, and DDoS protection
- Auto-generated domain names
- Load balancing across replicas
Enable Suga Domain
In the Public Networking section, click Enable next to Suga Domain. Specify the target port your application listens on (e.g., 3000, 8080). Public HTTPS traffic on port 443 routes to this port.
TCP Proxy
TCP proxy exposes non-HTTP protocols to the internet. Use Cases:- Direct database access (PostgreSQL, MySQL)
- SSH connections
- Custom protocols (MQTT, gRPC, WebSocket)
- Game servers
- Any TCP port
- Allocated load balancer port
- No automatic TLS (use application-level encryption)
Add TCP Proxy
In the Public Networking section, click + TCP Proxy. Enter the port your application listens on (e.g., 5432 for PostgreSQL).
Connection Timeouts
Suga Cloud applies explicit, predictable timeouts to all public traffic so connection behaviour is consistent across deployments.| Timeout | Applies To | Value | What It Means |
|---|---|---|---|
| Request header timeout | HTTPS endpoints | 15 seconds | Clients must finish sending HTTP request headers within 15 seconds of connecting. Protects shared edge infrastructure from slow or stalled clients. |
| Stream idle timeout | HTTPS endpoints | 5 minutes | An HTTP request, WebSocket, or SSE stream with no traffic in either direction for 5 minutes is closed. |
| TCP idle timeout | HTTPS endpoints, TCP Proxy | 1 hour | A TCP connection with no application data sent in either direction for 1 hour is closed. |
| Dead-peer detection | HTTPS endpoints, TCP Proxy | ~2.5 minutes | Suga Cloud probes idle connections and closes any whose peer has gone away (network partition, crashed client, etc.) within roughly 2.5 minutes. |
Keeping Long-Lived Connections Alive
For long-lived connections — WebSockets, Server-Sent Events, persistent database connections via TCP Proxy — make sure the client or server emits traffic more often than the relevant idle timeout:- WebSockets: send a ping frame every 1–2 minutes (well under the 5 minute stream idle timeout). Most WebSocket libraries can do this automatically.
- Server-Sent Events: emit a comment line (
: keepalive\n\n) or heartbeat event every 1–2 minutes. - TCP Proxy (e.g. databases): enable the protocol-level keepalive your client supports (PostgreSQL
keepalives_idle, MySQLwait_timeout, etc.), or expect to reconnect once an hour.
Dead-peer detection and the TCP idle timeout are independent. Dead-peer detection only closes connections whose peer is gone — it does not reset the idle timer for healthy-but-quiet connections.
Load Balancing
For services with multiple replicas, Suga automatically load balances traffic: HTTPS Endpoints:- Round-robin load balancing across replicas
- Round-robin load balancing
- Connection-level distribution
- Internal service load balancing across all replicas
- Connections are distributed automatically with no client-side configuration required
Load balancing is automatic. You don’t need to configure it manually.
WebSocket Support
WebSockets work automatically with HTTPS endpoints: Setup:- Configure your application to listen for WebSocket connections
- Enable HTTPS on the service
- Deploy
- Connect using
wss://(secure WebSocket)
Idle WebSockets are closed after 5 minutes. Have your client or server send a ping frame every 1–2 minutes to keep the connection open — see Connection Timeouts.
Network Isolation
Every environment runs inside its own isolated network boundary on Suga Cloud. Services in one environment cannot reach services in another over private networking, and the platform applies a default-deny security posture with explicit allow rules.Environment Boundaries
Between Environments:- Services in different environments (production, staging, dev) cannot communicate privately, even within the same project
- Each environment has its own isolated network with its own private DNS
- For cross-environment communication, use public networking
- Services in different projects cannot communicate privately
- Use public networking (HTTPS/TCP) for cross-project communication
Suga Cloud does not provision a dedicated VPC per project, and there is no cross-environment private routing. Environment isolation is enforced by network policy, not by separate networks.
Default-Deny Posture
Every environment starts with a default-deny policy and only the traffic listed below is permitted. Anything not explicitly allowed is dropped. Ingress (incoming connections to your services):| Source | Allowed |
|---|---|
| Other services in the same environment | Yes |
| Suga Cloud management traffic (TLS, ingress routing, health checks) | Yes |
| Services in other environments or projects | No |
| The public internet (direct) | No. Must go through a public endpoint |
| Destination | Allowed |
|---|---|
| DNS resolution | Yes |
| Other services in the same environment | Yes |
| Public internet (any external API or service) | Yes |
Private IP ranges outside the environment (RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) | No |
| Cloud provider metadata endpoints | No |
Public vs Private
- Private networking is internal-only and never exposed to the internet. It’s the only way services in the same environment talk to each other privately.
- Public networking (HTTPS endpoints, TCP proxies, custom domains) requires explicit configuration on each service and routes through Suga’s managed ingress with automatic TLS for HTTPS.
Common Patterns
Web Application
Frontend talks to backend, backend talks to database: Configuration:frontend: HTTPS enabled (public)api: HTTPS enabled (public)postgres: No public networking (private only)apiconnects topostgresviapostgres:5432
Microservices
Multiple services communicate privately, one acts as public gateway: Configuration:gateway: HTTPS enabled (public)users,orders,products: No public networking (private only)- Gateway connects to services via private networking
Common Questions
Can I use a custom port for HTTPS?
Can I use a custom port for HTTPS?
No, HTTPS always uses port 443. You specify your container port (e.g., 3000), and Suga routes port 443 to your container port automatically.
Do I need to configure SSL certificates?
Do I need to configure SSL certificates?
No, Suga automatically provisions and renews certificates for all HTTPS endpoints. Traffic is encrypted end-to-end through Cloudflare’s CDN.
Can I expose a database publicly?
Can I expose a database publicly?
Yes, using TCP proxy. However, it’s not recommended for security reasons. Keep databases private and access them via your application or a bastion host.
Can services in different projects communicate?
Can services in different projects communicate?
Not via private networking. Use public networking (HTTPS/TCP) or deploy related services in the same project.
How do I restrict access to public endpoints?
How do I restrict access to public endpoints?
Currently, public endpoints are accessible by anyone. Implement authentication in your application. IP allowlisting is planned for a future release.
Why are my long-running HTTP requests timing out at 15 seconds?
Why are my long-running HTTP requests timing out at 15 seconds?
The Free plan caps each HTTP request at 15 seconds total. Long-polling, large uploads or downloads, slow database queries served synchronously, and Server-Sent Events streams will be terminated at 15s. WebSockets are not affected — only the upgrade handshake is bounded by this timeout, and once established the connection is governed by the 5-minute stream idle timeout. Pro and Enterprise plans have no per-request total cap. See Request Timeout under Services.