HTTP Routing
Deploio routes incoming HTTP requests through a shared load balancer. The load balancer terminates TLS and forwards each request to your app. The following sections describe the limits and behavior of the load balancer.
The settings described here apply to all Deploio apps. You can't change them for an individual app.
Timeouts
| Timeout | Value | Behavior |
|---|---|---|
| Idle connection | 60 seconds | If neither the client nor your app sends any data for 60 seconds, the load balancer closes the connection. If your app hasn't responded, the client receives a 504 Gateway Timeout error. |
| Request headers | 5 seconds | If the client doesn't send the complete request headers within 5 seconds, the load balancer closes the connection with a 408 Request Timeout error. |
| WebSocket idle | 1 hour | If an open WebSocket connection carries no data in either direction for 1 hour, the load balancer closes the connection. |
Long-Running Requests
Deploio doesn't limit the total duration of a request. The 60-second idle timeout applies only while no data flows. A request can run for as long as your app sends data at least once every 60 seconds.
If your app needs more than 60 seconds before it can send a response, move the work out of the request. For example, process it in a worker job and let the client poll for the result.
Streaming Responses and Server-Sent Events
Streaming responses and server-sent events (SSE) are subject to the 60-second
idle timeout. To keep such a connection open, send data at least once every 60
seconds. For SSE, send a comment line such as : keep-alive every 30 seconds.
A deployment or platform maintenance can still close the connection. Browsers
that use the EventSource API reconnect automatically. Other clients must
implement reconnects themselves.
WebSockets
Deploio supports WebSocket connections without any configuration. Your app accepts the connection on the same port that it uses for HTTP.
WebSocket connections aren't permanent. Deploio closes them in the following cases:
- You deploy a new release of your app.
- Nine performs maintenance on the Deploio platform. Planned maintenance happens during weekly maintenance window.
- The connection carries no data for 1 hour.
Make sure that your clients handle closed connections:
- Reconnect automatically when the connection closes.
- Use exponential backoff with jitter for reconnect attempts. Many connections can close at the same time, and simultaneous reconnects can overload your app.
- Send a ping frame about every 30 seconds. Networks and proxies between the client and Deploio, such as corporate firewalls or CDNs, often close idle connections much earlier than Deploio does.
HTTP/2 and gRPC
Clients can connect to Deploio using HTTP/1.1 or HTTP/2. The load balancer always forwards requests to your app using HTTP/1.1, so your app doesn't need to support HTTP/2.
Deploio doesn't support gRPC because gRPC requires HTTP/2 between the load balancer and your app. As an alternative, use a protocol that works over HTTP/1.1, such as gRPC-Web or the Connect protocol.
Request Body Size
Deploio doesn't limit the size of request bodies. Large uploads are subject only to the idle timeout. After an upload completes, your app must start sending a response within 60 seconds.
Request Headers
The load balancer sets the following HTTP headers on each request to provide
information about the original request. The examples show a request from a
client at 203.0.113.7 that reaches Deploio through a CDN at 198.51.100.2.
| Header | Description | Example |
|---|---|---|
X-Forwarded-Host | The hostname that the client requested | http-headers.3a76d95.deploio.app |
X-Forwarded-Proto, X-Forwarded-Scheme | Whether the client made the original request over HTTPS or HTTP | https |
X-Forwarded-Port | The port number of the original request | 443 |
X-Forwarded-For, X-Real-Ip | The IP address of the client or proxy that connected to Deploio | 198.51.100.2 |
X-Original-Forwarded-For | The original chain of IP addresses that a proxy in front of Deploio sent in X-Forwarded-For | 203.0.113.7 |
Any client can set the X-Original-Forwarded-For header to an arbitrary value.
Only trust this header if all requests reach Deploio through a proxy that you
control or trust, such as a CDN.