[[["易于理解","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\u003eBase path routing in Apigee hybrid allows you to direct API proxy calls to the correct environment when multiple environments share the same host alias.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epaths.uri.prefixes\u003c/code\u003e property in the overrides file is used to explicitly map proxy base paths to specific environments, ensuring that calls are routed correctly.\u003c/p\u003e\n"],["\u003cp\u003eAdding a new environment to the same domain involves creating a new overrides file for the new environment and deploying the new environment components with a specified path prefix.\u003c/p\u003e\n"],["\u003cp\u003eTo add a new proxy base path to an existing environment, you need to add the new path as a \u003ccode\u003eprefixes\u003c/code\u003e entry to the \u003ccode\u003epaths.uri.prefixes\u003c/code\u003e in the environment's overrides file and apply the runtime changes.\u003c/p\u003e\n"]]],[],null,["# Configure base path routing\n\n| You are currently viewing version 1.1 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n| **NOTE:**Base path routing is supported in Apigee hybrid v1.1.0 and later releases.\n\n\nThis topic discusses base path routing. Base path routing allows you to configure\nand manage how Apigee hybrid routes API\nproxy calls to the correct environment.\n\nUse base path routing to manage proxy deployments\n-------------------------------------------------\n\n\nBecause you can map a single virtual host to\n[multiple environments](/apigee/docs/hybrid/v1.1/environments-about#environments-can-share-the-same-host-alias)\nin hybrid, you need\na way to specify which proxy base path maps to which environment.\n\n\nFor example, let's say you want to map two environments to the same host alias:\n`apitest.mydomain.net`. In your overrides file, you could create the following\nconfiguration where environments **dev1** and **dev2** both\nmap to this host. For example: \n\n```\nenvs:\n - name: dev1\n hostAlias: \"apitest.mydomain.net\"\n ...\n - name: dev2\n hostAlias: \"apitest.mydomain.net\"\n ...\n```\n\n\nNow, let's say you deploy proxies to these environments. You deploy:\n\n- Proxy **foo1** with base path **/foo1** to **dev1**\n- Proxy **foo2** with base path **/foo2** to **dev2**\n\n\nSuppose a client calls this API: `https://apitest.mydomain.net/foo1`. Note there's nothing\nin this path (or in the host header that's generated for the request) that tells hybrid\nwhich environment to route the call to. Is the **foo1** proxy deployed\nto **dev1** or **dev2** ?\nBased only on the request URL, there's no way to tell. **You must explicitly map each\nof these base paths to one or more environments.**\n\n\nTo specify which environment a proxy call should be routed to, add the\n`paths.uri.prefixes` property to the `envs` property in your overrides file,\nas shown in the following example: \n\n```\ngcpProjectID: example\nk8sClusterName: apigee-hybrid\n\n# Apigee org name.\norg: my-org\n\nenvs:\n # Apigee environment name.\n - name: dev1\n hostAlias: \"apitest.mydomain.net\"\n sslCertPath: ./certs/keystore.pem\n sslKeyPath: ./certs/keystore.key\n serviceAccountPaths:\n synchronizer: ./service-accounts/example-apigee-synchronizer.json\n udca: ./service-accounts/example-apigee-udca.json\n paths:\n uri:\n prefixes:\n - /foo1\n - name: dev2\n hostAlias: \"apitest.mydomain.net\"\n sslCertPath: ./certs/keystore.pem\n sslKeyPath: ./certs/keystore.key\n serviceAccountPaths:\n synchronizer: ./service-accounts/example-apigee-synchronizer.json\n udca: ./service-accounts/example-apigee-udca.json\n paths:\n uri:\n prefixes:\n - /foo2\n ...\n```\n\n\nNow, when an API call comes in such as: `https://apitest.mydomain.net/foo1`, the ingress\nrouter knows where to send it. It knows that the **/foo1** proxy\nis deployed to the **dev1**\nenvironment, and the call gets routed to **dev1**'s message processor.\n\n\nIf you send this call, `https://apitest.mydomain.net/foo2`, it is likewise routed to\nthe `dev2` environment's MP, and so on.\n\n\nIn summary, the `paths.uri.prefixes` configuration lets you manage proxy deployments\namong multiple environments that share the same host alias.\n\n\n**Best Practice** : Use base path routing when you want multiple environments to share\nthe same host alias. Base path routing lets you limit the number of proxies deployed to any\nsingle environment. For more information, see [Limit the number of proxy deployments](/apigee/docs/hybrid/v1.1/environments-about#limit-the-number-of-proxy-deployments).\n\nAdd a new environment to the same domain\n----------------------------------------\n\n\nThis section explains how to add a new environment to a domain.\n\n\nIn this scenario, assume that you have an environment `dev1` already deployed to\nthe cluster. In this example configuration, only proxies with the basepath prefix\n`/foo1` are allowed: \n\n```\ngcpProjectID: example\nk8sClusterName: apigee-hybrid\n\n# Apigee org name.\norg: my-org\n\nenvs:\n # Apigee environment name.\n - name: dev1\n hostAlias: \"apitest.mydomain.net\"\n sslCertPath: ./certs/keystore.pem\n sslKeyPath: ./certs/keystore.key\n serviceAccountPaths:\n synchronizer: ./service-accounts/example-apigee-synchronizer.json\n udca: ./service-accounts/example-apigee-udca.json\n paths:\n uri:\n prefixes:\n - /foo1\n\nmart:\n hostAlias: \"mart.apigee-hybrid-docs.net\"\n serviceAccountPath: ./service-accounts/example-apigee-mart.json\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.key\n\nmetrics:\n serviceAccountPath: ./service-accounts/willwitman-istio-25240157d44a.json\n```\n\n\nTo add another environment that shares the same domain, follow these steps:\n\n1. Create a new overrides file with the new enviroment configuration. For example, this configuration creates an environment called `dev2`. In this environment, only proxies with the path suffix `/foo2` are allowed: \n\n ```\n gcpProjectID: example\n k8sClusterName: apigee-hybrid\n\n # Apigee org name.\n org: my-org\n\n envs:\n # Apigee environment name.\n - name: dev2\n hostAlias: \"apitest.mydomain.net\"\n sslCertPath: ./certs/keystore.pem\n sslKeyPath: ./certs/keystore.key\n serviceAccountPaths:\n synchronizer: ./service-accounts/example-apigee-synchronizer.json\n udca: ./service-accounts/example-apigee-udca.json\n paths:\n uri:\n prefixes:\n - /foo2\n\n mart:\n hostAlias: \"mart.apigee-hybrid-docs.net\"\n serviceAccountPath: ./service-accounts/example-apigee-mart.json\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.key\n\n metrics:\n serviceAccountPath: ./service-accounts/willwitman-istio-25240157d44a.json\n ```\n2. Run the following commands in any order:\n 1.\n\n ```\n apigeectl apply -f overrides/overrides-dev2.yaml -c udca\n ```\n 2.\n\n ```\n apigeectl apply -f overrides/overrides-dev2.yaml -c synchronizer\n ```\n 3.\n\n ```\n apigeectl apply -f overrides/overrides-dev2.yaml -c runtime\n ```\n3. Deploy the proxy **foo2** to the **dev2** environment.\n4. Call the proxy to test the setup. \n\n ```\n curl https://apitest.mydomain.net/foo2\n ```\n\nAdd a new proxy base path to an existing environment\n----------------------------------------------------\n\n\nTo add a new base path to an existing environment, simply add a `prefixes`\nentry for each new base path. For example, if you create a new proxy with the base path\n**/foo4** , and you want to deploy\nit to the environment called **dev2**, follow these steps:\n\n1. Open the overrides file that has the definition of the **dev2** environment.\n2. Add the `/foo4` base path to the `paths.uri.prefixes` element: \n\n ```\n gcpProjectID: example\n k8sClusterName: apigee-hybrid\n\n # Apigee org name.\n org: my-org\n\n envs:\n # Apigee environment name.\n - name: dev2\n hostAlias: \"apitest.mydomain.net\"\n sslCertPath: ./certs/keystore.pem\n sslKeyPath: ./certs/keystore.key\n serviceAccountPaths:\n synchronizer: ./service-accounts/example-apigee-synchronizer.json\n udca: ./service-accounts/example-apigee-udca.json\n paths:\n uri:\n prefixes:\n - /foo2\n - /foo4\n\n mart:\n hostAlias: \"mart.apigee-hybrid-docs.net\"\n serviceAccountPath: ./service-accounts/example-apigee-mart.json\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.key\n\n metrics:\n serviceAccountPath: ./service-accounts/willwitman-istio-25240157d44a.json\n ```\n3. Apply the `runtime` component to the cluster: \n\n ```\n apigeectl apply -f overrides/overrides-dev2.yaml -c runtime\n ```\n4. Call the proxy to test the setup. \n\n ```\n curl https://apitest.mydomain.net/foo4\n ```\n\n\n If an API call comes in for `https://apitest.mydomain.net/foo4`, hybrid knows\n to route it to environment `dev2`."]]