Hostalias and Virtualhosts : Private Cloud

When you use Apigee cloud and deploy a API you could notice the Deployments showing the endpoint to access the API using the URL like this,

748-screen-shot-2015-07-11-at-44215-pm.png

This article will provide you steps if you are not seeing the URL in your private cloud deployment.

How the UI shows the URL?

UI just fetches the HostAlias configured in the Virtual host configuration.

What is Virtualhost?

http://apigee.com/docs/api-services/content/virtual-hosts

What is HostAlias?

Host alias is simple a way to bind a DNS name to the Virtualhost [a port on which the Router is listening], it can be domain name or just a ip:port

Look for more details here, http://apigee.com/docs/api-services/content/creating-virtual-host

How to setup HostAlias in Virtualhost?

When you run setup-org.sh script to create an org in private cloud -- the script will ask you to provide the hostalias for virtual host configuration for every virtualhosts in every envrionment created. If you do not provide the hostalias information during the setup time, do not worry - you can always use the management API to update the values at a later point in time, when you know the domain names

Step1: Get Virtualhost

Use this API to get the Virtualhost [preferably in JSON]

GET /v1/o/{orgname}/e/{envname}/virtualhosts/{vhname}

http://apigee.com/docs/management/apis/get/organizations/%7Borg_name%7D/environments/%7Benv_name%7D/...

Step 2: Update Virtualhost

Update the Virtualhost payload with the host alias and send a PUT request

PUT /v1/o/{orgname}/e/{envname}/virtualhosts/{vhname}

{
  "hostAliases" : [ "{alias}" ],
  "interfaces" : [ ],
  "name" : "default",
  "port" : "{port}"
}

After this, refresh the UI - it would start displaying the endpoint to access your API

Version history
Last update:
‎07-11-2015 02:00 PM
Updated by: