Skip to main content
Suga provides two networking modes: Private Networking for internal service communication, and Public Networking for exposing services to the internet.

Networking Overview

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
Format:
Examples:
  • 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. It starts as a DNS-safe version of the service’s display name (lower case, with spaces and underscores turned into hyphens and other characters dropped), with a -2 or -3 suffix if that name is already taken. Override it to use a friendlier name like postgres or api. 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.
Public networking ports (HTTPS endpoints, TCP proxies, custom domains) are automatically reachable on the private hostname as well, so you don’t need to list them twice.

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. See CDN and Regions for the edge architecture and where requests get routed. Features:
  • Port 443 (HTTPS)
  • Automatic TLS certificates via Cloudflare
  • Cloudflare CDN, WAF, and DDoS protection
  • Auto-generated domain names
  • Traffic spread across replicas
Auto-Generated Domains: Suga generates a domain for each HTTPS endpoint. It combines the service’s ID, the environment name, and a label identifying the cluster your organization runs in. Example:
The service ID is the short identifier Suga assigns, not the name you gave the service, so renaming a service does not change its generated address. The domain is fixed once the endpoint is created. You can change which port it serves, but not the address itself. Because the address is assigned rather than chosen, avoid copying it into another service by hand. Reference it instead, so it stays correct if you add a custom domain later:
See Environment Variables for how references work, and Custom Domains to serve on your own domain instead. Configuration:
1

Select Service

Click on the service you want to expose.
2

Open Config Tab

In the properties panel, open the Config tab.
3

Add the Generated URL

In the Public Networking section, click Add next to Generated URL. Specify the target port your application listens on (e.g., 3000, 8080). Public HTTPS traffic on port 443 routes to this port.
4

Apply

Click Apply. Your service will be accessible at the generated URL.

TCP Proxy

TCP proxy exposes non-HTTP protocols to the internet. Use Cases:
  • Direct database access (PostgreSQL, MySQL)
  • SSH connections
  • Custom protocols (MQTT)
  • Game servers
Standard wss:// WebSockets go through the HTTPS path — see WebSocket Support. TCP Proxy is only needed for non-HTTP protocols.
Features:
  • Any TCP port
  • Allocated load balancer port
  • No automatic TLS (use application-level encryption)
Configuration:
1

Select Service

Click on the service to expose.
2

Open Config Tab

In the properties panel, open the Config tab.
3

Add TCP Proxy

In the Public Networking section, click + TCP Proxy. Enter the port your application listens on (e.g., 5432 for PostgreSQL).
4

Apply

Click Apply. Note the allocated hostname and port in the Public Networking section.
5

Connect

Use the hostname and allocated port shown in the UI:
TCP proxy does not provide TLS encryption by default. Use application-level encryption (like PostgreSQL’s SSL mode) or consider keeping the service private.

Connection Timeouts

Suga Cloud applies explicit, predictable timeouts to all public traffic so connection behaviour is consistent across deployments. These limits apply to traffic through public ingress (HTTPS endpoints and TCP Proxy) — private service-to-service connections inside an environment aren’t subject to these idle timeouts. The stream idle, TCP idle, and dead-peer detection limits apply equally on every plan. The request header timeout applies to Free plan services only. See Plan Limits.

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 keepalive your client supports, such as PostgreSQL keepalives_idle, or TCP-level SO_KEEPALIVE on the socket for clients without a protocol-level option. Otherwise expect to reconnect every 15 minutes.
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 spreads traffic across replicas automatically. This applies to HTTPS endpoints, TCP proxies, and private service-to-service traffic. The distribution strategy is not configurable, and Suga does not guarantee a particular one, so don’t rely on requests landing on a specific replica.
Load balancing is automatic. You don’t need to configure it manually.

WebSocket Support

WebSockets work automatically with HTTPS endpoints: Setup:
  1. Configure your application to listen for WebSocket connections
  2. Enable HTTPS on the service
  3. Deploy
  4. 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.
Example:

Server-Sent Events Support

Server-Sent Events (SSE) work automatically with HTTPS endpoints — no special configuration required. Setup:
  1. Configure your application to respond with Content-Type: text/event-stream
  2. Enable HTTPS on the service
  3. Deploy
  4. Connect using EventSource from the client
Idle SSE streams are closed after 5 minutes. Emit a comment line (: keepalive\n\n) or heartbeat event every 1–2 minutes to keep the connection open. See Connection Timeouts.
Example:

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
Between Projects:
  • 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): Egress (outbound connections from your services): Blocking RFC 1918 ranges prevents services from reaching internal infrastructure they shouldn’t see, including other tenants’ private IPs. Blocking metadata endpoints prevents workloads from harvesting cloud credentials or instance identity from the underlying host.

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)
  • api connects to postgres via postgres: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

No, HTTPS always uses port 443. You specify your container port (e.g., 3000), and Suga routes port 443 to your container port automatically.
No, Suga automatically provisions and renews certificates for all HTTPS endpoints. Traffic from the client to Suga’s gateway is encrypted, and TLS terminates at the gateway.
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.
Not via private networking. Use public networking (HTTPS/TCP) or deploy related services in the same project.
Currently, public endpoints are accessible by anyone. Implement authentication in your application. IP allowlisting is planned for a future release.