> [!CAUTION]
> You are currently viewing version 1.13 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](https://docs.cloud.google.com/apigee/docs/hybrid/supported-platforms.md.txt#supported-versions).

<button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">Version 1.13 </button>

- Supported versions:
- [v1.17 (latest)](https://docs.cloud.google.com/apigee/docs/hybrid/v1.17/base-path-routing.md.txt)
- [v1.16](https://docs.cloud.google.com/apigee/docs/hybrid/v1.16/base-path-routing.md.txt)
- [v1.15](https://docs.cloud.google.com/apigee/docs/hybrid/v1.15/base-path-routing.md.txt)
- [v1.14](https://docs.cloud.google.com/apigee/docs/hybrid/v1.14/base-path-routing.md.txt)
- [List of supported versions](https://docs.cloud.google.com/apigee/docs/hybrid/supported-platforms.md.txt#supported-versions)
- Unsupported versions:
- [v1.13](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/base-path-routing.md.txt)
- [v1.12](https://docs.cloud.google.com/apigee/docs/hybrid/v1.12/base-path-routing.md.txt)
- [v1.11](https://docs.cloud.google.com/apigee/docs/hybrid/v1.11/base-path-routing.md.txt)
- [v1.10](https://docs.cloud.google.com/apigee/docs/hybrid/v1.10/base-path-routing.md.txt)
- [v1.9](https://docs.cloud.google.com/apigee/docs/hybrid/v1.9/base-path-routing.md.txt)
- [v1.8](https://docs.cloud.google.com/apigee/docs/hybrid/v1.8/base-path-routing.md.txt)
- [v1.7](https://docs.cloud.google.com/apigee/docs/hybrid/v1.7/base-path-routing.md.txt)
- [v1.6](https://docs.cloud.google.com/apigee/docs/hybrid/v1.6/base-path-routing.md.txt)
- [v1.5](https://docs.cloud.google.com/apigee/docs/hybrid/v1.5/base-path-routing.md.txt)
- [v1.4](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/base-path-routing.md.txt)
- [v1.3](https://docs.cloud.google.com/apigee/docs/hybrid/v1.3/base-path-routing.md.txt)
- [v1.2](https://docs.cloud.google.com/apigee/docs/hybrid/v1.2/base-path-routing.md.txt)
- [v1.1](https://docs.cloud.google.com/apigee/docs/hybrid/v1.1/base-path-routing.md.txt)


This topic discusses the [virtualhosts](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/config-prop-ref.md.txt#virtualhosts) configuration property.
Virtual hosts allow Apigee hybrid to handle
API requests to hostaliases associated with an environment group. For more information, see
[Routing and base
paths](https://docs.cloud.google.com/apigee/docs/api-platform/fundamentals/environments-overview#routing) in the [About
environments and environment groups](https://docs.cloud.google.com/apigee/docs/api-platform/fundamentals/environments-overview) topic.

```
...
virtualhosts:
  - name: my-env-group
    sslCertPath: ./certs/fullchain.pem
    sslKeyPath: ./certs/privkey.key
...
```


When an API proxy call comes, it is routed to the host alias(es) of the environment group
where the API proxy is deployed.


For instructions on how to apply `virtualhosts` to the cluster, see
[Applying virtualhosts changes](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/base-path-routing.md.txt#applying). For information about configuring
TLS, see [Configuring TLS and mTLS on the Istio ingress](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/ingress-tls.md.txt).

## Adding multiple virtual hosts


The `virtualhosts[]` property is an array, and therefore you can create more than
one.

```
...
virtualhosts:
  - name: my-env-group-1
    sslCertPath: ./certs/fullchain1.pem
    sslKeyPath: ./certs/privkey1.key

  - name: my-env-group-2
    sslCertPath: ./certs/fullchain2.pem
    sslKeyPath: ./certs/privkey2.key
...
```

> [!TIP]
> **Tip:** For security purposes, it is best practice to have a separate TLS cert/key pair for each virtual host. If you are using a Subject Alternative Name (SAN ) certificate, this TLS cert/key pair should be used on one virtual host that is shared across the domain.


For information about configuring
TLS, see [Configuring TLS and mTLS on the Istio ingress](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/ingress-tls.md.txt).

## Applying `virtualhosts` changes


If you only add or change the `virtualhosts` property, apply the changes with the `apigee-virtualhost` chart and the name of the environment group to which you are applying the changes:

```
helm upgrade $ENV_GROUP apigee-virtualhost/ \
  --namespace apigee \
  --atomic \
  --set envgroup=$ENV_GROUP \
  -f OVERRIDES_FILE.yaml
```

> [!NOTE]
> **Note:** If you see an error saying `Error: UPGRADE FAILED: "*ENV_GROUP*" has no deployed releases`, replace `upgrade` with `install` and try the command again.

If, for example, you change
`virtualhosts` and `env`,
then you must apply the change with `helm upgrade` without using the
`ENV_GROUP apigee-virtualhost/`flag to update the cluster. For
example:

Run helm upgrade for each environment you want to update.

```
helm upgrade $ENV_NAME apigee-env/ \
  --namespace apigee \
  --atomic \
  --set env=$ENV_NAME \
  -f OVERRIDES_FILE.yaml
```

> [!NOTE]
> **Note:** If you see an error saying `Error: UPGRADE FAILED: "*ENV_NAME*" has no deployed releases`, replace `upgrade` with `install` and try the command again.

## TLS keys and certificates

The `virtualhost` property requires a TLS key and certificate.
The key/cert are used to provide secure communication with the ingress gateway and
must be compatible with the host aliases used in the specified environment group.


It is up to you how you generate proper TLS certificate/key pairs for your hybrid
configuration. The following topics are provided as samples only, intended primarily
for trying out or testing a new hybrid installation if it isn't feasible to obtain
TLS credentials in another way:

- See [Obtain TLS credentials](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/lets-encrypt.md.txt) for a set of sample steps for creating an authorized TLS certificate/key pair.
- You can use a self-signed certificate/key pair(s) for testing purposes only. See [Generate self-signed TLS credentials](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/environment-self-signed-tls.md.txt).