You can refer to the official documentation to configure the timeout.
Key: x-envoy-upstream-rq-timeout-ms
Value: your preffered value in milliseconds. For example, 30000 for 30 seconds
3. Save and test the API.
Add a header injection policy for the API instance in its corresponding declarative configuration file as shown below:
- policyRef:
name: header-injection-flex
config:
inboundHeaders:
- key: x-envoy-upstream-rq-timeout-ms
value: "30000"
For more details, refer to the "Policy Binding" and "Examples" sections in the following link:
https://docs.mulesoft.com/gateway/latest/flex-local-configuration-reference-guide#policy-binding
# curl -v http://127.0.0.1:8081/200?sleep=20000 * Trying 127.0.0.1:8081... * Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0) > GET /200?sleep=20000 HTTP/1.1 > Host: 127.0.0.1:8081 > User-Agent: curl/7.81.0 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 504 Gateway Timeout < content-length: 24 < content-type: text/plain < date: Tue, 31 Jan 2023 05:39:16 GMT < server: Anypoint Flex Gateway < * Connection #0 to host 127.0.0.1 left intact upstream request timeout
# curl -v http://127.0.0.1:8081/200?sleep=20000 * Trying 127.0.0.1:8081... * Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0) > GET /200?sleep=20000 HTTP/1.1 > Host: 127.0.0.1:8081 > User-Agent: curl/7.81.0 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < content-length: 6 < content-type: text/plain < date: Tue, 31 Jan 2023 05:41:16 GMT < request-context: appId=cid-v1:3548b0f5-7f75-492f-82bb-b6eb0e864e53 < server: Anypoint Flex Gateway < set-cookie: ARRAffinity=8d9749e1ad54987267d51cda41194309f78e9fe336b09f44ea04d81342bdd40c;Path=/;HttpOnly;Secure;Domain=httpstat.us < set-cookie: ARRAffinitySameSite=8d9749e1ad54987267d51cda41194309f78e9fe336b09f44ea04d81342bdd40c;Path=/;HttpOnly;SameSite=None;Secure;Domain=httpstat.us < strict-transport-security: max-age=2592000 < x-envoy-upstream-service-time: 20551 < * Connection #0 to host 127.0.0.1 left intact 200 OK
Disclaimer: This solution is provided as a reference for your own usage and is not to be considered a MuleSoft feature. This solution should be considered as a custom solution. The custom solution is not a Supported MuleSoft product.
001115387

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.