Setup Custom Domain for Application

Updated by Chris Sterling on Jul 17, 2015


Application developers


When an application is deployed to AppFog a URL is generated based on a route and domain. An example for an application that is deployed to the AppFog US East region named myapp would be:

The default domain in the AppFog US East region is and the US West region is The application's name is typically used for the route, or sub-domain, in the URL. Setting up a custom domain for your application involves creating a custom domain and route. The following sections will take you through this process.


In order to setup a custom domain for applications on AppFog you must be logged in from the command line. If you are not familiar with accessing AppFog from the command line follow the instructions in the Login to AppFog using the Cloud Foundry CLI article before moving onto the following sections.

Setup Custom Domain

AppFog provides the ability to manage a custom domain within each region. For the purposes of this article we will be using as the example domain and ACME as example AppFog account name. In order to use the domain with our application deployment, run the following command:

$ cf create-domain ACME
Creating domain for org ACME as me...

In order to verify that the domain is now available for use in AppFog application routing for your account, run the follow command:

$ cf domains
Getting domains in org ACME as me...
name                   status   shared  owned

You should see your domain in the list with a status of owned.

Setup Custom Route

You can map your application to a custom route with a specified domain now using the cf map-route command:

$ cf map-route myapp

Now if a request for were to come to AppFog it would be routed to the myapp application.

Setting Up DNS with 3rd Party Provider

In order for users to access your application at the custom domain there needs to be a DNS (domain name service) entry that describes how to route traffic to AppFog. AppFog's external IP addresses are not static and should not be used for a DNS A Record. At your DNS provider create a redirect(302) from your root domain <YOUR_DOMAIN> routing to www.<YOUR_DOMAIN>. For this example, will redirect to This is a fairly standard tool that DNS services provide. If you don’t see an option for it at your domain host, contact their support services and they may be able to do that for you. Once the root domain redirect is established, you then can map a CNAME record pointing to AppFog. Depending on the region your app is deployed either create the CNAME Record directing to or For instance, to map in the US East region you would have a CNAME record like this:

CNAME www 1 min

If your DNS provider is unable to create a redirect from your root domain you many need to consider another DNS provider. Some DNS providers are also offering the option of a CNAME record for your root domain. If this is available you do not need to create a redirect from your root domain, simply create the same CNAME entry as for www.<YOUR_DOMAIN>. Remember to also create and map the domain on AppFog if using your root domain.

Setting up SSL for your custom domain

Setting up SSL certifications to match your custom domain will require the use of a third-party provider, like CloudFlare. See for more information.

Additional Information

For more information on additional capabilities in Cloud Foundry for custom domains (on which AppFog is based), please check out this page on the Cloud Foundry Foundation documentation site:

Customer Support

Can’t find what you need?
Give us a call.


M – F, 8am to 6pm