Was this helpful?

On the Apigee Platform, every organization has at least two environments: 'test' and 'prod'. Each environment has at least one 'virtual host' definition. To set up a custom domain, you must modify the virtual host definition.

Fetch the virtual host definition

$ curl -u myname:mypass https://api.enterprise.apigee.com/v1/o/{myorg}/e/{environment_name}/virtualhosts

Download the virtual host definition to a file on your local machine:

$ curl -u myname:mypass https://api.enterprise.apigee.com/v1/o/{myorg}/e/{environment_name}/virtualhosts/default > vh.json

Add your host to the virtual host definition

Open the file vh.json. You'll see that there is one host defined for the 'default' virtual host:

{ "hostAliases" : [ "{myorg}-{environment}.apigee.net" ], "interfaces" : [ ], "name" : "default", "port" : "80" }

If you have not done so, configure a Cname setting in DNS to use for your API.

Edit the file to add your host alias:

{ "hostAliases" : [ "{myorg}-{environment}.apigee.net", "api.your.name.here.com" ], "interfaces" : [ ], "name" : "default", "port" : "80" } 

Now update the virtual host definition on the server:

Update the existing virtual host definition on Apigee with the new definition

$ curl -u myname:mypass https://api.enterprise.apigee.com/v1/o/{myorg}/e/{environment_name}/virtualhosts/default -H "Content-Type: application/json" -X PUT -T vh.json 

Next Steps

If you have questions or issues, post to the Apigee Developer Forum.