[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-05 UTC。"],[[["\u003cp\u003eThis document addresses \u003ccode\u003eGateway Timeout\u003c/code\u003e errors (HTTP status \u003ccode\u003e504\u003c/code\u003e) in Apigee and Apigee hybrid, specifically related to the \u003ccode\u003eTARGET_READ_TIMEOUT\u003c/code\u003e reason.\u003c/p\u003e\n"],["\u003cp\u003eThe default target read timeout in Apigee is 55 seconds, and requests exceeding this limit will result in a timeout error unless the timeout limit is configured to a new value, which has a maximum limit of 300 seconds.\u003c/p\u003e\n"],["\u003cp\u003eA "slow target" and a "TargetServer connectivity issue" are the two primary causes for a target timeout, with instructions provided on how to diagnose them using the Apigee Debug Tool.\u003c/p\u003e\n"],["\u003cp\u003eTo resolve a slow target issue, it's recommended to avoid slow targets or increase the timeout period by modifying the \u003ccode\u003eio.timeout.millis\u003c/code\u003e property in the TargetEndpoint configuration.\u003c/p\u003e\n"],["\u003cp\u003eFor target connectivity issues, the \u003ccode\u003e<LoadBalancer>\u003c/code\u003e element can be removed temporarily for a more precise diagnosis, and if the issue remains, there is a requirement of diagnostic information for support.\u003c/p\u003e\n"]]],[],null,["# 504 Gateway timeout - Target read timeout\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nThere is no equivalent\n[Apigee Edge](https://docs.apigee.com/api-platform/get-started/get-started) documentation for this topic.*\n\nSymptom\n-------\n\n\nThis issue appears as a `Gateway Timeout` error with HTTP status `504`.\n\nError Message\n-------------\n\nYou may see this error in [API Monitoring](/apigee/docs/api-monitoring/investigate), [Debug](/apigee/docs/api-platform/debug/trace), or other tools. The `TARGET_READ_TIMEOUT` reason indicates that Apigee runtime did not receive a timely response from the target during the execution of a request.\n\n\u003cbr /\u003e\n\n\nThe default target read timeout value\n([io.timeout.millis](/apigee/docs/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification))\nis 55 seconds. Which means that if after 55 seconds the target doesn't respond, Apigee throws\nthis error: \n\n```\n{\"fault\":{\"faultstring\":\"Gateway Timeout\",\n \"detail\":{\"errorcode\":\"messaging.adaptors.http.flow.GatewayTimeout\",\n \"reason\":\"TARGET_READ_TIMEOUT\"}}}\n```\n\nPossible Causes\n---------------\n\nCause: Slow Target\n------------------\n\n### Diagnosis\n\n\nYou can diagnose a slow target issue using the Apigee [Debug Tool](/apigee/docs/api-platform/debug/trace):\n\n1. Create a [debug session](/apigee/docs/api-platform/debug/trace#create) for your API proxy.\n2. In the debug session, send a request and inspect the debug output.\n\n\nAs you can see in the example above, the Target Request exceeded 55 seconds, which is the\n[default\ntarget timeout](/apigee/docs/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification)\nlimit. The time limit is configurable, and if you have changed the timeout, then the duration\nof the Target Request will match the timeout you set. For instance, if your timeout is 10 seconds,\nthen in that scenario a target request will timeout after 10 seconds. Such \"slow target\" behavior is a clear\nindication that the target is not responding to a request in time.\n\n### Resolution\n\nApigee recommends that you avoid using [slow targets](/apigee/docs/api-platform/antipatterns/slow-backend).\nFor example, if normal target latency is 50 ms, and you experience a latency of 55000 ms, you\nmay need to investigate if there is a problem with the target.\n\n\nIf you must increase the timeout, follow these steps:\n\n1. Click on the **Develop** tab in the proxy editor.\n2. In the navigation pane, select the affected target endpoint.\n3. In the XML editor, find the `HTTPTargetConnection` XML element: \n\n\n4. Add the `io.timeout.millis` property under the `\u003cHTTPTargetConnection\u003e` element and specify the new time limit in milliseconds, for example: \n\n ```text\n \u003cHTTPTargetConnection\u003e\n \u003cURL\u003ehttps://my-very-slow-target.example.com\u003c/URL\u003e\n \u003cProperties\u003e\n \u003cProperty name=\"io.timeout.millis\"\u003e120000\u003c/Property\u003e\n \u003c/Properties\u003e\n \u003c/HTTPTargetConnection\u003e\n ```\n\n\n In the example above the timeout is increased to 120 seconds. Note that 300 seconds\n is the maximum limit. For further information, see\n [Endpoints\n property reference](/apigee/docs/api-platform/reference/endpoint-properties-reference).\n5. Save the new revision and deploy the proxy.\n\n\nIf the problem persists, go to [Must gather\ndiagnostic information](#mustgatherinfo) below.\n\n\nCause: TargetServer connectivity issue\n--------------------------------------\n\n\u003cbr /\u003e\n\n### Diagnosis\n\n\nApigee does not reveal the exact cause of a connectivity issue when you configure the\n[\u003cLoadBalancer\u003e](/apigee/docs/api-platform/deploy/load-balancing-across-backend-servers#configuringatargetendpointtoloadbalanceacrossnamedtargetservers)\nendpoint property. You may be able to infer the cause of a connectivity problem, however,\nfrom the elapsed time of the Target Request. As a debugging method, you can try to remove\nthe `\u003cLoadBalancer\u003e` element altogether, and try to hit the target directly in the proxy.\n\n\nTo diagnose the issue, use the [Debug Tool](/apigee/docs/api-platform/debug/trace).\n\n1. Create a [debug session](/apigee/docs/api-platform/debug/trace#create) for your API proxy.\n2. In the debug session, send a request and inspect the debug output.\n\n\n\u003cbr /\u003e\n\n\nIn the example above, it took nine seconds for a timeout to occur. Since it is not 55 seconds,\nyou know the cause of the error is not that the timeout limit was exceeded due to a slow target.\nBy default, Apigee retries a connection two additional times if the `\u003cLoadBalancer\u003e` element\nis used on the TargetEndpoint. Because you know that connection has been attempted three times\nin total, and the default timeout for a connection error is three seconds\n([connect.timeout.millis](/apigee/docs/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification)),\nyou can assume that the issue is a connectivity issue.\n\n### Resolution\n\n\nIf the issue is confirmed to be a connection timeout, see [VPC Peering 503 Service Unavailable error with TARGET_CONNECT_TIMEOUT](/apigee/docs/api-platform/troubleshoot/playbooks/runtime/vpc-503-target-connect-timeout).\n\n\nFor other issues, remove the `\u003cLoadBalancer\u003e`\nelement to debug and reveal the exact\nerror code, and check for the code in the\n[error catalog](/apigee/docs/api-platform/errorcatalog/mp-runtime-errorcatalog).\n\nMust Gather Diagnostic Information\n----------------------------------\n\n\nIf the problem persists even after following the above instructions, gather the following\ndiagnostic information and then contact [Google\nCloud Support](https://cloud.google.com/support-hub):\n\n1. Project ID and the Apigee organization name\n2. Proxy name(s) and the environment.\n3. Time-frame of the issue.\n4. Frequency of the issue\n5. Target hostname.\n6. [Debug session](/apigee/docs/api-platform/debug/trace#download) with the issue."]]