[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-27。"],[[["\u003cp\u003eThis guide explains how to enable request and response streaming in Apigee and Apigee hybrid to handle large payloads that exceed the default 10 MB buffer limit.\u003c/p\u003e\n"],["\u003cp\u003eEnabling streaming allows unmodified data transfer for requests and responses between the client app and the target endpoint, bypassing the in-memory buffer.\u003c/p\u003e\n"],["\u003cp\u003eStreaming should be enabled when API proxies handle very large requests and responses to avoid \u003ccode\u003eprotocol.http.TooBigBody\u003c/code\u003e errors due to the 10 MB buffer size limit.\u003c/p\u003e\n"],["\u003cp\u003eWhile streaming can handle large payloads, Apigee recommends not exceeding 10 MB and using signed URLs for larger files to avoid potential performance issues.\u003c/p\u003e\n"],["\u003cp\u003eTo enable streaming, set \u003ccode\u003erequest.streaming.enabled\u003c/code\u003e and \u003ccode\u003eresponse.streaming.enabled\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e within the \u003ccode\u003eProxyEndpoint\u003c/code\u003e and \u003ccode\u003eTargetEndpoint\u003c/code\u003e definitions in your proxy bundle.\u003c/p\u003e\n"]]],[],null,["# Streaming requests and responses\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nWhat you'll learn in this topic\n-------------------------------\n\nAfter reading this topic you will know the following:\n\n- What request and response streaming on Apigee is\n- When to use request and response streaming\n- How to enable request and response streaming\n\n| **Sample:** If you'd like to jump directly to a code sample, see [Related code samples](#RelatedCodeSamples) for details.\n\nWhat is request and response streaming?\n---------------------------------------\n\nBy default, HTTP streaming is disabled and HTTP request and response payloads are written to a\nbuffer in memory before they are processed by the API proxy pipeline. You can change this\nbehavior by enabling streaming. With streaming enabled, request and response payloads are\nstreamed without modification to the client app (for responses) and the target endpoint (for\nrequests).\n\nWhen should I enable streaming?\n-------------------------------\n\nIf your API proxy handles very large requests and/or responses (for size limits, see\n[What else should I know about streaming](#whatelseshouldiknowaboutstreaming)), you\nmay want to enable streaming.\n| **Note:** If your API requests or returns a large amount of data, you may see this HTTP error: \n|\n| ```text\n| {\"fault\":\"{\\\"detail\\\":{\\\"errorcode\\\":\\\"protocol.http.TooBigBody\\\"},\\\"faultstring\\\":\\\"Body buffer overflow\\\"}\"}\n| ```\n|\n| If you see this error, we recommend that you enable streaming. If you continue to see the\n| error after you enable streaming, consider removing any policies that require access to the\n| request or response payload. For more information, see\n| [Message payload size](/apigee/docs/api-platform/fundamentals/best-practices-api-proxy-design-and-development#size).\n\nWhat else should I know about streaming?\n----------------------------------------\n\nMessage payload size is restricted to 30 MB.\nIn non-streamed requests and responses, exceeding\nthat size results in a `protocol.http.TooBigBody` error.\n| **Caution:** While streaming can help you work around the\n| 30 MB request/response size limit enforced by the product,\n| Apigee doesn't recommend exceeding that limit when streaming and can't support issues that\n| arise as a result of exceeding that limit, such as performance issues, timeouts, and so on.\n|\n| For payloads larger than 30 MB, Apigee recommends using a\n| signed URLs pattern within an Apigee JavaCallout, illustrated by the\n| [Edge Callout: Signed URL Generator](https://github.com/DinoChiesa/ApigeeEdge-Java-GoogleUrlSigner) example on GitHub.\n| **Note:** With streaming enabled, Apigee strongly recommends you do **not** attach policies that require access to the request or response payload. Those types of policies will either cause errors or trigger buffering in the API proxy, which limits payload size to the numbers listed above and defeats the purpose of enabling streaming to handle large payloads. You can attach policies that do not interact with the request/response body, such as authentication or message logging policies.\n\n### Encoded data\n\nWhen streaming is enabled, Apigee does *not* encode or decode request or response\npayloads before sending them to the client connecting to Apigee or a backend target server. See\nthe rows for `request.streaming.enabled` and `response.streaming.enabled`\nin the\n[TargetEndpoint Transport Property Specification](/apigee/docs/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification) table for more information.\n\nHow to enable request and response streaming\n--------------------------------------------\n\nTo enable request streaming you need to add the `request.streaming.enabled`\nproperty to the ProxyEndpoint and TargetEndpoint definitions in the proxy bundle and set it to\n`true`. Similarly, set the\n`response.streaming.enabled` property to enable response streaming.\n\nYou can locate these configuration files in the Apigee UI in the Develop view for your\nproxy. If you are developing locally, these definition files are in `apiproxy/proxies`\nand `apiproxy/targets`.\n\nThis sample shows how to enable both request and response streaming in the TargetEndpoint\ndefinition. \n\n```text\n\u003cTargetEndpoint name=\"default\"\u003e\n \u003cHTTPTargetConnection\u003e\n \u003cURL\u003ehttp://mocktarget.apigee.net\u003c/URL\u003e\n \u003cProperties\u003e\n \u003cProperty name=\"response.streaming.enabled\"\u003etrue\u003c/Property\u003e\n \u003cProperty name=\"request.streaming.enabled\"\u003etrue\u003c/Property\u003e\n \u003cProperty name=\"supports.http10\"\u003etrue\u003c/Property\u003e\n \u003cProperty name=\"request.retain.headers\"\u003eUser-Agent,Referer,Accept-Language\u003c/Property\u003e\n \u003cProperty name=\"retain.queryparams\"\u003eapikey\u003c/Property\u003e\n \u003c/Properties\u003e\n \u003c/HTTPTargetConnection\u003e\n\u003c/TargetEndpoint\u003e\n```\n\nThis example shows how to enable response and request streaming in the ProxyEndpoint\ndefinition: \n\n```text\n\u003cProxyEndpoint name=\"default\"\u003e\n \u003cHTTPProxyConnection\u003e\n \u003cBasePath\u003e/v1/weather\u003c/BasePath\u003e\n \u003cProperties\u003e\n \u003cProperty name=\"allow.http10\"\u003etrue\u003c/Property\u003e\n \u003cProperty name=\"response.streaming.enabled\"\u003etrue\u003c/Property\u003e\n \u003cProperty name=\"request.streaming.enabled\"\u003etrue\u003c/Property\u003e\n \u003c/Properties\u003e\n \u003c/HTTPProxyConnection\u003e\n\u003c/ProxyEndpoint\u003e\n```\n\nFor more information about configuring endpoint definitions, see [Endpoint properties reference](/apigee/docs/api-platform/reference/endpoint-properties-reference).\n\nRelated code\nsamples\n--------------------\n\nAPI proxy samples on GitHub are easy to download and use.\n\nSample proxies that feature streaming include:\n\n- [streaming](https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/streaming) - Demonstrates an API proxy configured for HTTP streaming.\n- [Edge Callout: Signed URL Generator](https://github.com/DinoChiesa/ApigeeEdge-Java-GoogleUrlSigner) - Illustrates the best practice of generating a signed URL to access large files instead of trying to stream them in a request/response."]]