Apigee hybrid 會使用 Istio 輸入閘道處理傳入的 API 流量。MART 和執行階段服務都已設定 Istio 入口閘道,以便管理叢集外公開的連線。舉例來說,這表示 Istio 入口閘道會先處理所有傳送至 API Proxy 的 HTTP 和 HTTPS 要求。
在混合式中,您會建立一或多個環境,並為每個環境指派主機別名。主機別名是 DNS 名稱。針對該 DNS 名稱的流量,Ingress 會將流量轉送至該環境。在內部,每個環境都會指派給一個且只有一個
訊息處理器,負責處理 Proxy 要求、套用政策,以及將流量路由至目標服務和從目標服務傳送。因此,主機別名會決定哪個訊息處理器會接收任何指定的傳入要求。
[[["容易理解","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-08-21 (世界標準時間)。"],[[["\u003cp\u003eThis documentation version is end-of-life and should be upgraded to a newer version, as outlined in the supported versions documentation.\u003c/p\u003e\n"],["\u003cp\u003eApigee hybrid uses environments to provide isolated sandboxes for API proxies, where each environment is linked to a unique host alias (DNS name) that determines which message processor handles incoming requests.\u003c/p\u003e\n"],["\u003cp\u003eBest practice dictates creating multiple environments and deploying a limited number of proxies to each, rather than deploying all proxies to a single environment, which can cause a plethora of issues.\u003c/p\u003e\n"],["\u003cp\u003eEnvironments can share the same host alias, but this necessitates using base path routing to direct traffic to the appropriate environment based on the proxy's base path.\u003c/p\u003e\n"],["\u003cp\u003eLimiting the number of proxies per environment improves message processor boot-up time, prevents unnecessary scaling of all proxies due to high traffic on one, and minimizes the impact of proxy crashes.\u003c/p\u003e\n"]]],[],null,["# About environments\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\nAn *environment* provides an isolated context or \"sandbox\" for running API proxies.\nIn a single organization, you can create multiple environments. For more information, see\n[About environments and environment groups](/apigee/docs/api-platform/fundamentals/environments-overview).\n\nDuring a basic installation, you [added an\nenvironment](/apigee/docs/hybrid/v1.1/precog-add-environment) for testing. It's a best practice, however, to create multiple environments\nand to deploy a [limited number of proxies](#limit-the-number-of-proxy-deployments)\nto each one.\n\nAbout virtual hosts and environments\n------------------------------------\n\n\nApigee hybrid uses\n[Istio ingress gateways](https://istio.io/docs/tasks/traffic-management/ingress/ingress-control/)\nto handle incoming API traffic. The MART and\nruntime services are both configured with Istio ingress gateways to manage their\nconnections that are exposed outside the cluster. This\nmeans, for example, that all HTTP and HTTPS requests to an API proxy are first handled\nby an Istio ingress gateway.\n\n\nIn hybrid, you create one or more environments and assign to each environment a *host alias* .\nThe host alias is a DNS name. Incoming traffic to that DNS name is routed by the ingress to that\nenvironment. Internally, each environment is assigned to one and only one [message processor](/apigee/docs/hybrid/v1.1/mp-config),\nwhich does the work of processing proxy requests, applying policies and routing traffic to and\nfrom target services. Therefore, the host alias determines which message processor receives any\ngiven incoming request.\n\n\nThe following code shows an example configuration where multiple environments are\ndefined. (Such configurations belong in your overrides file.) Note that environments\n**dev1** and **prod1** have different host aliases: \n\n```\nenvs:\n - name: dev1\n hostAlias: \"apitest.mydomain.net\"\n ...\n\n - name: prod1\n hostAlias: \"apiprod.mydomain.net\"\n ...\n```\n\n\nSuppose a proxy with the base path `/foo1` is deployed to environment\n**dev1**. You could call the proxy like this: \n\n```\ncurl -k https://apitest.mydomain.net/foo1\n```\n\n\nWhen this call hits the ingress, the ingress knows to send it to the message processor\nassociated with the `dev1` environment, which handles the request.\n\n\nSimilarly, if `foo1` is also deployed to the `prod1` environment,\nyou could make a proxy\nrequest like this, to the host alias `apiprod.mydomain.net`: \n\n```\ncurl -k https://apiprod.mydomain.net/foo1\n```\n\n\nAnd the call is routed by the ingress to the MP associated with that host.\n| **NOTE** On a request to an API proxy, the ingress compares the `Host` header of the incoming request to the list of host aliases to determine which virtual host handles the request. `curl` commands, browsers, and many other utilities automatically set the `Host` header with the domain of the request. If for any reason your app is not setting the `Host` header automatically, you must set it manually.\n\n\nIn summary, each environment that you create must have a host alias assigned to it.\nEach environment maps to one and only one message processor, and the host alias determines\nwhich message processor receives a given request.\n\nEnvironments can share the same host alias\n------------------------------------------\n\n\nApigee hybrid lets you create multiple environments that you can manage however you wish. For\ninstance, you can create several dev environments, **dev1** , **dev2** ,\n**dev3**, and so on, and map a\nsingle host alias to each one. Furthermore, you can deploy multiple proxies to each environment.\n\n\n**Antipattern**: Deploy all of your proxies to one hybrid environment.\n\n\n**Best practice** : Create multiple environments and deploy a limited number of proxies\nto each one. The technique for managing how hybrid routes proxy calls to the correct\nenvironment that share a host alias is called [base path routing](/apigee/docs/hybrid/v1.1/base-path-routing).\n\n\nFor example, in the following configuration, environments **dev1** and\n**dev2** share the same host alias: \n\n```\nenvs:\n - name: dev1\n hostAlias: \"apitest.mydomain.net\"\n ...\n - name: dev2\n hostAlias: \"apitest.mydomain.net\"\n ...\n```\n\n\nWhen multiple environments share the same host alias, you must use\nthe configuration technique called\n*base path routing* to map specific proxy base paths to specific environments. See\n[base path routing](/apigee/docs/hybrid/v1.1/base-path-routing) for more information.\n\nLimit the number of proxy deployments\n-------------------------------------\n\n\nFor hybrid, the fact that many environments can share the same virtual host means\nthat you must think carefully about how you manage your proxy deployments to any given\nenvironment. In hybrid, the best practice is to create multiple environments and deploy\na limited number of proxies to each one.\n\n\n**How many proxies should you deploy to an environment?** There is not a set answer\nto this question; however, the following table provides general guidance on why it's a\ngood idea to limit the number of proxies deployed to each environment and what you\nneed to think about when managing proxy deployments:\n| **NOTE:** When deciding how many proxies to deploy to an environment, be sure to consider the product configuration limits described in [Limits](/apigee/docs/api-platform/reference/limits#hybrid).\n\nEnviroment configuration reference\n----------------------------------\n\n\nFor a complete list of environment configuration elements, see `envs` in the\n[Configuration property reference](/apigee/docs/hybrid/v1.1/config-prop-ref#envs).\n\nWorking with environments\n-------------------------\n\n\nFor more information about configuration, see the following topics:\n\n- [Creating new environments](/apigee/docs/hybrid/v1.1/environment-create)\n- [Deleting environments](/apigee/docs/hybrid/v1.1/environment-delete)\n- [Base path routing](/apigee/docs/hybrid/v1.1/base-path-routing)"]]