클라이언트가 이 API(https://apitest.mydomain.net/foo1)를 호출한다고 가정해 보겠습니다. 이 경로(또는 요청에 대해 생성된 호스트 헤더)에는 하이브리드에게 호출을 라우팅할 환경을 설명하는 어떠한 항목도 없습니다. foo1 프록시가 dev1 또는 dev2에 배포되었나요?
요청 URL만을 기반으로 이를 알 수 있는 방법은 없습니다. 이러한 기본 경로를 하나 이상의 환경에 명시적으로 매핑해야 합니다.
프록시 호출이 라우팅될 환경을 지정하려면 다음 예시와 같이 재정의 파일의 envs 속성에 paths.uri.prefixes 속성을 추가합니다.
이제 다음과 같은 API 호출(https://apitest.mydomain.net/foo1)이 수신되면 인그레스 라우터는 전송할 위치를 인식합니다. 인그레스 라우터는 /foo1 프록시가 dev1 환경에 배포되며 호출이 dev1의 메시지 프로세서로 라우팅된다는 것을 인식합니다.
이 호출 https://apitest.mydomain.net/foo2를 보내면 dev2 환경의 MP 등으로 라우팅될 수 있습니다.
요약하면, paths.uri.prefixes 구성을 사용하면 동일한 호스트 별칭을 사용하는 여러 환경 간에 프록시 배포를 관리할 수 있습니다.
권장사항: 여러 환경에서 동일한 호스트 별칭을 공유하려는 경우 기본 경로 라우팅을 사용하세요. 기본 경로 라우팅을 사용하면 단일 환경에 배포된 프록시 수를 제한할 수 있습니다. 자세한 내용은 프록시 배포 수 제한을 참조하세요.
동일한 도메인에 새 환경 추가
이 섹션에서는 도메인에 새 환경을 추가하는 방법을 설명합니다.
이 시나리오에서는 클러스터에 dev1 환경이 이미 배포되었다고 가정합니다. 이 구성 예시에서는 기본 경로 프리픽스가 /foo1인 프록시만 허용됩니다.
[[["이해하기 쉬움","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-04(UTC)"],[[["\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`."]]