---
schema_version: "1"
id: f0a9441a17c766c7a557d6c4e0c578814d731a8625b8eb449b4bd6126a7f5c6e
title: Configuring Timeouts in Local Mode
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/latest/local-timeout.md
canonical_url: https://docs.mulesoft.com/gateway/latest/local-timeout
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 7b0b42c2c695d50fa3e3efe57a33957ece5ea4c15a8041f8f24158fa432a08ae
description: MuleSoft Documentation Site
release: "1.14"
latest: true
---
---
product: Omni Gateway
version: 1.14
is-latest-version: true
---

# Configuring Timeouts in Local Mode

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

Omni 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 Omni Gateway) or outbound (Omni
  Gateway to upstream service) direction.

  By default, all Omni 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 Omni
  Gateway and the upstream service can remain idle between requests.

  By default, all Omni 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 Omni Gateway waits for a
  response from an upstream service. The timeout time starts at the last request sent by Omni
  Gateway.

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

You can configure these timeouts in Local Mode via:

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

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

- Policy: Applies to one API instance or upstream and provides granular control.

## 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: 60
    upstreamResponseSeconds: 15
    streamIdleSeconds: 300
```

## Configure Timeouts via Policies

Apply these policies to your API instance or upstream service:

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

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

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