---
schema_version: "1"
id: 62c0ec5a8e29d07620fbbbc1b7696f472330c35d2a596e1b98ff376731271e2c
title: Configuring Timeouts in Connected Mode
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.9/flex-conn-timeout.md
canonical_url: https://docs.mulesoft.com/gateway/1.9/flex-conn-timeout
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 2f6432e89914335ccecbe4f589a171fc7afeb729186ffc126f13a9d2b825a389
description: MuleSoft Documentation Site
release: "1.9"
latest: false
---
---
product: Omni Gateway
version: 1.9
---

# Configuring Timeouts in Connected Mode

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Flex Gateway offers these timeouts to improve service quality and reduce computing resource waste:

- **Stream Idle Timeout**  
  The Stream Idle Timeout enables you to set a maximum amount of a time a stream can remain idle
  without receiving any data in either the inbound (client to Flex Gateway) or outbound (Flex
  Gateway to upstream service) direction.

  By default, all Flex Gateway API instances have a stream timeout of 300 seconds.

- **Upstream Idle Timeout**  
  The Upstream Idle Timeout enables you to set a maximum amount of time a stream between Flex
  Gateway and the upstream service can remain idle between requests.

  By default, all Flex Gateway API instances have an upstream idle timeout of 60 seconds.

- **Response Timeout**  
  The Response Timeout enables you to set a maximum amount of a time Flex Gateway waits for a
  response from an upstream service. The timeout time starts at the last request sent by Flex
  Gateway.

  By default, all Flex Gateway API instances have a response timeout of 15 seconds.

You can configure these timeouts via:

- Environment variables: Applies to all API instances and is the most permanent configuration
  option.

- Configuration YAML file: Applies to all API instances and is easy to adjust.

- Policy: Applies to just one API instance or upstream providing granularity and is easy to adjust.

## Configure Timeouts via Environment Variables

Configure timeouts with these environment variables:

FLEX\_STREAM\_IDLE\_TIMEOUT\_SECONDS: 300
FLEX\_UPSTREAM\_CONNECTION\_IDLE\_TIMEOUT\_SECONDS/FLEX\_CONNECTION\_IDLE\_TIMEOUT\_SECONDS: 60
FLEX\_UPSTREAM\_RESPONSE\_TIMEOUT\_SECONDS: 15

Edit the variables with your desired configurations.

## Configure Timeouts via YAML Configuration Resources

Edit and then apply this configuration resource to update your timeouts:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
  name: timeouts-config
spec:
  timeouts:
    upstreamConnectionIdleSeconds: 300
    upstreamResponseSeconds: 15
    streamIdleSeconds: 60
```

## Configure Timeouts via Policies

Apply these policies to your API instance or upstream service:

- [Stream Idle Timeout Policy](https://docs.mulesoft.com/gateway/1.9/policies-included-stream-idle-timeout)

- [Upstream Idle Timeout Policy](https://docs.mulesoft.com/gateway/1.9/policies-outbound-upstream-idle-timeout)

- [Response Timeout Policy](https://docs.mulesoft.com/gateway/1.9/policies-included-response-timeout)
