[[["易于理解","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-28。"],[[["\u003cp\u003eThis content focuses on proxy chaining in Apigee and Apigee hybrid, a method to connect two proxies directly, improving performance by avoiding network hops.\u003c/p\u003e\n"],["\u003cp\u003eProxy chaining is done by specifying one proxy as a local target endpoint of another using the \u003ccode\u003eLocalTargetConnection\u003c/code\u003e element, and this can be done by proxy name or endpoint path.\u003c/p\u003e\n"],["\u003cp\u003eWhen using proxy chaining, each proxy involved counts as one call towards billing and usage limits.\u003c/p\u003e\n"],["\u003cp\u003eConnecting proxies through proxy chaining should be done with care to avoid recursive loops, which could cause system overload.\u003c/p\u003e\n"],["\u003cp\u003eFor security, proxy chaining is recommended when both proxies are in the same API product, and if a proxy in the chain should be secured from outside requests, then internal checks such as IP validation should be used.\u003c/p\u003e\n"]]],[],null,["# Chaining API proxies together\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\nYou can specify that one proxy is the target endpoint of another, effectively connecting the\ntwo proxies in a proxy chain. Chaining proxies in this way can help you avoid a network hop, and\nso improve overall performance.\n| **Note:** Each proxy in the chain is billed as one call, and counts as one call toward [limits](/apigee/docs/api-platform/reference/limits).\n| **Note:** Proxy chaining provides one way to reuse proxies. For another way, in which you develop components that are expressly designed to be reused, be sure to see [Reusable shared flows](/apigee/docs/api-platform/fundamentals/shared-flows).\n\nWith proxy chaining, you specify that one proxy is the local target endpoint of the other.\nRather than using the `HTTPTargetConnection` element to make a call to the second\nproxy, you use the `LocalTargetConnection` element. \n\n```text\n\u003cLocalTargetConnection\u003e\n \u003cAPIProxy\u003emyproxy2\u003c/APIProxy\u003e\n \u003cProxyEndpoint\u003edefault\u003c/ProxyEndpoint\u003e\n\u003c/LocalTargetConnection\u003e\n```\n\nYou might find proxy chaining useful when you have a proxy that offers some discrete low-level\nfunctionality that other proxies will consume. For example, a proxy that exposes\ncreate/read/update/delete operations with a backend data store could be the target proxy for\nmultiple other proxies that expose the data to clients.\n| **Note:** Proxies you want to connect in this way must be in the same organization and environment. When the proxy you're connecting with is outside this scope, consider connecting to it as an external resource using the `HTTPTargetConnection` element (as described in [API proxy configuration reference](/apigee/docs/api-platform/reference/api-proxy-configuration-reference)).\n**Note:** This video was recorded with a previous version of the Apigee UI; however, the concepts are still valid. \n**Video:** Watch a short video to learn more about API proxy chaining. \n\nHow proxy chaining works\n------------------------\n\nProxy chaining uses a local connection to minimize network overhead when calling one proxy\nfrom another. This local connection is more efficient because it bypasses network features such\nas load balancers, routers, and message processors.\n\nThe following illustrates the difference between connecting proxies with\n`HTTPTargetConnection`\nand `LocalTargetConnection` (proxy chaining):\n\nYou connect proxies by specifying that one is a local target endpoint of the other.\nFor the configuration in the diagram above (Proxy-to-proxy call with proxy chaining),\nyou would specify that ProxyB (/proxyB) is a\nlocal target endpoint of ProxyA (/proxyA). This causes requests arriving at ProxyA to\nbe forwarded to ProxyB.\n\nYou can create a local connection between proxies in two ways:\n\n- By specifying the name of the target proxy and a ProxyEndpoint name\n- By specifying a path to the target proxy endpoint\n\nYou connect target proxies within a `TargetEndpoint` configuration, using a\n`LocalTargetConnection` element, as described below.\n| **Warning:** When chaining API proxies, take care to avoid infinite loop recursive callouts back into the same API proxy, which could result in system overload.\n| **Note:** If you are using Apigee hybrid v1.14 or newer and your organization is entitled to use the [`Enhanced per-environment proxy limits`](/apigee/docs/hybrid/v1.14/enhanced-proxy-limits) feature, you must set the [`enhanceProxyLimits`](/apigee/docs/hybrid/v1.14/config-prop-ref#enhanceproxylimits) property to `true` in your `overrides.yaml` file in order to use proxy chaining.\n\nConnecting proxies by proxy name\n--------------------------------\n\nYou can specify the target proxy by name. You might find that this is most useful when you're\ncreating the connection from the start and developing the proxies together. If you don't know the\nname (or the name might change), consider connecting with the target proxy's endpoint path, as\ndescribed below.\n\nWhen you connect to a target proxy by name, you specify the proxy's name and the name of its\n`ProxyEndpoint`.\n\nThe following example specifies a target proxy called `data-manager`, along with\nthe `ProxyEndpoint` name exposed by `data-manager`. For reference\ninformation, see [API proxy configuration reference](/apigee/docs/api-platform/reference/api-proxy-configuration-reference).\n| The `\u003cAPIProxy\u003e` and `\u003cProxyEndpoint\u003e` elements support the dynamic string substitution feature called [message templating](/apigee/docs/api-platform/reference/message-template-intro).\n**Important:** If you implement proxy chaining using the proxy name, the second proxy will not show results in [Debug](/apigee/docs/api-platform/debug/trace-overview) even when you call Debug for it. Use [Proxy chaining by path](#connectingproxiesbypath) instead if you need to use Debug on the second proxy. \n\n```text\n\u003cTargetEndpoint name=\"datamanager\"\u003e\n \u003cPreFlow name=\"PreFlow\"\u003e\n \u003c!-- PreFlow policies --\u003e\n \u003c/PreFlow\u003e\n \u003cPostFlow name=\"PostFlow\"\u003e\n \u003c!-- PostFlow policies --\u003e\n \u003c/PostFlow\u003e\n \u003cLocalTargetConnection\u003e\n \u003cAPIProxy\u003edata-manager\u003c/APIProxy\u003e\n \u003cProxyEndpoint\u003edefault\u003c/ProxyEndpoint\u003e\n \u003c/LocalTargetConnection\u003e\n\u003c/TargetEndpoint\u003e\n```\n\nConnecting proxies by path\n--------------------------\n\nYou can specify the target proxy by its endpoint path. You might want to do it this way when\nyou don't know the proxy name, or when the name might change.\n\nIf your proxy is simply the consumer of the target proxy---such as when you're not\ndeveloping both---the path might be the most reliable way to connect. For example, if the\nproxy you're\nconnecting to is developed and maintained by another team, you might want to connect using a\nreliable endpoint path.\n\nThe following example specifies a target proxy at\n`/v1/streetcarts/foodcarts/data-manager`, where the host is assumed to be the same as\nthe current proxy. For reference information, see [API proxy configuration reference](/apigee/docs/api-platform/reference/api-proxy-configuration-reference). \n\n```text\n\u003cTargetEndpoint name=\"datamanager\"\u003e\n \u003cPreFlow name=\"PreFlow\"\u003e\n \u003c!-- PreFlow policies --\u003e\n \u003c/PreFlow\u003e\n \u003cPostFlow name=\"PostFlow\"\u003e\n \u003c!-- PostFlow policies --\u003e\n \u003c/PostFlow\u003e\n \u003cLocalTargetConnection\u003e\n \u003cPath\u003e/v1/streetcarts/foodcarts/data-manager\u003c/Path\u003e\n \u003c/LocalTargetConnection\u003e\n\u003c/TargetEndpoint\u003e\n```\n\n\nThe `\u003cPath\u003e` element under `\u003cLocalTargetConnection\u003e`\ncan be a string, or you can use a [message template](/apigee/docs/api-platform/reference/message-template-intro) to assign a value dynamically.\n\nConnecting proxies using the Apigee UI\n--------------------------------------\n\nYou can also connect proxies, either by proxy name or path, using the Apigee UI.\nIn the following example, there are two proxies, ProxyA and ProxyB, and you want\nProxyB to be a target endpoint of ProxyA. To connect the proxies by proxy name,\ndo the following steps:\n\n1. Go to the proxies list. \n\n### Apigee in Cloud console\n\nIn the Google Cloud console, go to the **Proxy development \\\u003e API proxies** page.\n\n[Go to API proxies](https://console.cloud.google.com/apigee/proxies)\n\n### Classic Apigee UI\n\n1. Sign in to the [Apigee UI](https://apigee.google.com).\n2. Select **Develop \\\u003e Proxies** in the left-hand pane.\n2. In the list of proxies, select **ProxyA**.\n3. Click the **Develop** tab.\n4. In the **Code** pane, replace the `\u003cTargetEndpoint\u003e` section of the XML with the following: \n\n ```text\n \u003cTargetEndpoint\u003e\n \u003cLocalTargetConnection\u003e\n \u003cAPIProxy\u003eProxyB\u003c/APIProxy\u003e\n \u003cProxyEndpoint\u003edefault\u003c/ProxyEndpoint\u003e\n \u003c/LocalTargetConnection\u003e\n \u003c/TargetEndpoint\u003e\n ```\n5. Click **Save**.\n\nChained proxies, API products, and security\n-------------------------------------------\n\nProxy chaining is best for cases where both proxies are in the same API product. By default,\nboth are available to clients. Apigee currently doesn't support bundling the second\nproxy in a separate API product that clients shouldn't have access to.\n\nIf your second proxy must be secured against direct client requests, consider adding logic to\nhave your second proxy examine the IP address of the client. In the case of a call made with\nchaining, the IP address will be local. Your code can validate that it is local before allowing\nprocessing to continue. See the [AccessControl policy](/apigee/docs/api-platform/reference/policies/access-control-policy) for one way to do this."]]