---
schema_version: "1"
id: 783a2f739555f8a5173c106a1d525145537fa01a0ec7f5413835b17446658630
title: Upstream Idle Timeout Policy
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.9/policies-outbound-upstream-idle-timeout.md
canonical_url: https://docs.mulesoft.com/gateway/1.9/policies-outbound-upstream-idle-timeout
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c92bb750db3df715f3f984a5682592c2b6b48c3ea0bdcb991aaf4d789f753d85
description: MuleSoft Documentation Site
release: "1.9"
latest: false
---
---
product: Omni Gateway
version: 1.9
keywords: basic authentication, api gateway, flex gateway, gateway, policy
---

# Upstream Idle Timeout Policy

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

<table><colgroup><col> <col></colgroup><tbody><tr><td><p><strong>Policy Name</strong></p></td><td><p>Stream Idle Timeout</p></td></tr><tr><td><p><strong>Summary</strong></p></td><td><p>Sets the maximum idle duration for a stream between the Flex Gateway and an upstream service</p></td></tr><tr><td><p><strong>Category</strong></p></td><td><p>Quality of Service</p></td></tr><tr><td><p><strong>First Flex Gateway version available</strong></p></td><td><p>v1.9.0</p></td></tr><tr><td><p><strong>Returned Status Codes</strong></p></td><td><p>504 - Upstream request timeout</p></td></tr></tbody></table>

## Summary

The Upstream Idle Timeout policy lets you set a maximum idle duration between requests for a stream
between Flex Gateway and the upstream service. By applying the policy, you prevent idle connections
from consuming resources while simultaneously allowing persistent connections to remain open. The
timeout starts at the last request.

By default, all Flex Gateway API instances have an upstream idle timeout of 60 seconds. Apply the
policy to override the default timeout.

## Configuring Policy Parameters

### Flex Gateway Local Mode

In Local Mode, you apply the policy to your API via declarative configuration files. Refer to the
following policy definition and table of parameters:

\- policyRef: name: idle-timeout-flex config: timeout: number // REQUIRED

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Required or Optional</th><th>Default Value</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>timeout</code></p></div></div></td><td><div><div><p>Required</p></div></div></td><td><div><div><p>60</p></div></div></td><td><div><div><p>Time in seconds before Flex Gateway closes the connection.</p></div></div></td></tr></tbody></table>

#### Resource Configuration Example

\- policyRef: name: idle-timeout-flex config: timeout: 3

### Managed Flex Gateway and Flex Gateway Connected Mode

When you apply the policy to your API instance from the UI, the following parameters are displayed:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Element</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td><div><div><p>Upstream idle timeout</p></div></div></td><td><div><div><p>Time in seconds before Flex Gateway closes the connection.</p></div></div></td><td><div><div><p>Yes</p></div></div></td></tr></tbody></table>
