Configure base path routing

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, seeSupported versions.
NOTE:Base path routing is supported in Apigee hybrid v1.1.0 and later releases.

This topic discusses base path routing. Base path routing allows you to configure and manage how Apigee hybrid routes API proxy calls to the correct environment.

Use base path routing to manage proxy deployments

Because you can map a single virtual host tomultiple environments in hybrid, you need a way to specify which proxy base path maps to which environment.

For example, let's say you want to map two environments to the same host alias:apitest.mydomain.net. In your overrides file, you could create the following configuration where environmentsdev1 anddev2 both map to this host. For example:

envs:  - name: dev1    hostAlias: "apitest.mydomain.net"    ...  - name: dev2    hostAlias: "apitest.mydomain.net"    ...

Now, let's say you deploy proxies to these environments. You deploy:

  • Proxyfoo1 with base path/foo1 todev1
  • Proxyfoo2 with base path/foo2 todev2

Suppose a client calls this API:https://apitest.mydomain.net/foo1. Note there's nothing in this path (or in the host header that's generated for the request) that tells hybrid which environment to route the call to. Is thefoo1 proxy deployed todev1 ordev2? Based only on the request URL, there's no way to tell.You must explicitly map each of these base paths to one or more environments.

To specify which environment a proxy call should be routed to, add thepaths.uri.prefixes property to theenvs property in your overrides file, as shown in the following example:

gcpProjectID: examplek8sClusterName: apigee-hybrid# Apigee org name.org: my-orgenvs:    # Apigee environment name.  - name: dev1    hostAlias: "apitest.mydomain.net"    sslCertPath: ./certs/keystore.pem    sslKeyPath: ./certs/keystore.key    serviceAccountPaths:      synchronizer: ./service-accounts/example-apigee-synchronizer.json      udca: ./service-accounts/example-apigee-udca.json    paths:      uri:        prefixes:          - /foo1  - name: dev2    hostAlias: "apitest.mydomain.net"    sslCertPath: ./certs/keystore.pem    sslKeyPath: ./certs/keystore.key    serviceAccountPaths:      synchronizer: ./service-accounts/example-apigee-synchronizer.json      udca: ./service-accounts/example-apigee-udca.json    paths:      uri:        prefixes:          - /foo2    ...

Now, when an API call comes in such as:https://apitest.mydomain.net/foo1, the ingress router knows where to send it. It knows that the/foo1 proxy is deployed to thedev1 environment, and the call gets routed todev1's message processor.

If you send this call,https://apitest.mydomain.net/foo2, it is likewise routed to thedev2 environment's MP, and so on.

In summary, thepaths.uri.prefixes configuration lets you manage proxy deployments among multiple environments that share the same host alias.

Best Practice: Use base path routing when you want multiple environments to share the same host alias. Base path routing lets you limit the number of proxies deployed to any single environment. For more information, see Limit the number of proxy deployments.

Add a new environment to the same domain

This section explains how to add a new environment to a domain.

In this scenario, assume that you have an environmentdev1 already deployed to the cluster. In this example configuration, only proxies with the basepath prefix/foo1 are allowed:

gcpProjectID: examplek8sClusterName: apigee-hybrid# Apigee org name.org: my-orgenvs:    # Apigee environment name.  - name: dev1    hostAlias: "apitest.mydomain.net"    sslCertPath: ./certs/keystore.pem    sslKeyPath: ./certs/keystore.key    serviceAccountPaths:      synchronizer: ./service-accounts/example-apigee-synchronizer.json      udca: ./service-accounts/example-apigee-udca.json    paths:      uri:        prefixes:          - /foo1mart:  hostAlias: "mart.apigee-hybrid-docs.net"  serviceAccountPath: ./service-accounts/example-apigee-mart.json  sslCertPath: ./certs/fullchain.pem  sslKeyPath: ./certs/privkey.keymetrics:  serviceAccountPath: ./service-accounts/willwitman-istio-25240157d44a.json

To add another environment that shares the same domain, follow these steps:

  1. Create a new overrides file with the new enviroment configuration. For example, this configuration creates an environment calleddev2. In this environment, only proxies with the path suffix/foo2 are allowed:
    gcpProjectID: examplek8sClusterName: apigee-hybrid# Apigee org name.org: my-orgenvs:    # Apigee environment name.  - name: dev2    hostAlias: "apitest.mydomain.net"    sslCertPath: ./certs/keystore.pem    sslKeyPath: ./certs/keystore.key    serviceAccountPaths:      synchronizer: ./service-accounts/example-apigee-synchronizer.json      udca: ./service-accounts/example-apigee-udca.json    paths:      uri:        prefixes:          - /foo2mart:  hostAlias: "mart.apigee-hybrid-docs.net"  serviceAccountPath: ./service-accounts/example-apigee-mart.json  sslCertPath: ./certs/fullchain.pem  sslKeyPath: ./certs/privkey.keymetrics:  serviceAccountPath: ./service-accounts/willwitman-istio-25240157d44a.json
  2. Run the following commands in any order:
    1. apigeectl apply -f overrides/overrides-dev2.yaml -c udca
    2. apigeectl apply -f overrides/overrides-dev2.yaml -c synchronizer
    3. apigeectl apply -f overrides/overrides-dev2.yaml -c runtime
  3. Deploy the proxyfoo2 to thedev2 environment.
  4. Call the proxy to test the setup.
    curl https://apitest.mydomain.net/foo2

Add a new proxy base path to an existing environment

To add a new base path to an existing environment, simply add aprefixes entry for each new base path. For example, if you create a new proxy with the base path/foo4, and you want to deploy it to the environment calleddev2, follow these steps:

  1. Open the overrides file that has the definition of thedev2 environment.
  2. Add the/foo4 base path to thepaths.uri.prefixes element:
    gcpProjectID: examplek8sClusterName: apigee-hybrid# Apigee org name.org: my-orgenvs:    # Apigee environment name.  - name: dev2    hostAlias: "apitest.mydomain.net"    sslCertPath: ./certs/keystore.pem    sslKeyPath: ./certs/keystore.key    serviceAccountPaths:      synchronizer: ./service-accounts/example-apigee-synchronizer.json      udca: ./service-accounts/example-apigee-udca.json    paths:      uri:        prefixes:          - /foo2- /foo4mart:  hostAlias: "mart.apigee-hybrid-docs.net"  serviceAccountPath: ./service-accounts/example-apigee-mart.json  sslCertPath: ./certs/fullchain.pem  sslKeyPath: ./certs/privkey.keymetrics:  serviceAccountPath: ./service-accounts/willwitman-istio-25240157d44a.json
  3. Apply theruntime component to the cluster:
    apigeectl apply -f overrides/overrides-dev2.yaml -c runtime
  4. Call the proxy to test the setup.
    curl https://apitest.mydomain.net/foo4

    If an API call comes in forhttps://apitest.mydomain.net/foo4, hybrid knows to route it to environmentdev2.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.