Create a Custom Domain for Cloudant Using Cloudflare

What’s in a name? Proxy to get speed and protection too.


This document is now obsolete — now that Cloudant no longer supports custom sub-domains, this is no longer a valid way of using a custom domain.

When signing up for an IBM Cloudant account through, you pick a username, which becomes the sub-domain of, e.g. If you create a Cloudant service inside Bluemix, then you are assigned a randomly-generated sub-domain like If you want to assign a custom domain to your Cloudant account, then you could perform the DNS magic yourself, but it would leave you with the responsibility of dealing with the creation of an HTTPS certificate for your domain.

A much simpler alternative is to sign up for a Cloudflare account and let them do the heavy lifting! Cloudflare is a proxy service that sits between your users and your website handling caching, immunity to denial-of-serivce attacks, analytics, content optimisation, and lots more. In this case, we are going to place Cloudflare in front of a Cloudant account.

This article assumes you have your own custom domain name already (like and have already signed up for a Cloudant account (like We want to create a new sub-domain:, which will work with HTTPS and whose traffic will be sent to Cloudant.

Sign up for Cloudflare

Visit and create an account. Enter your custom domain name and let Cloudflare perform its initial scan.

Add a CNAME record

Once the Cloudflare scan of your existing domain is complete, we can tell Cloudflare that we wish to proxy to To do this, we create a CNAME record by completing the form:

Here, we choose the CNAME type from the pull-down list and enter the new sub-domain (db) and our target (

Tell Cloudant about your domain name

Cloudant also needs to know about this new naming strategy. In the Cloudant dashboard, select Account > Virtual Hosts and complete the form. Enter your new domain name ( and click the Add Domain button:


After a few minutes, you should be able to visit and (HTTPS may take up to 24 hours to take effect). That's it!

Note: If you bind your proxied Cloudant service to a Bluemix app, this mapping will not take effect because the VCAP_SERVICES entry for Cloudant will not reflect the new domain name.

Benefits of using Cloudflare and Cloudant

Cloudflare offers several benefits for Cloudant users

  • HTTP2. Cloudflare supports HTTP2/SPDY out of the box. So requests from HTTP2-compatible sources (like Google Chrome) would benefit from the smaller binary protocol, the single multiplexed connection, and the compressed headers that HTTP2 affords.
  • Free HTTPS. Your custom domain can be covered by a free HTTPS certificate without any fuss.
  • DDoS protection. If you are paying for a quota of Cloudant requests, then the last thing you want is for a bad actor to maliciously call your Cloudant account directly at your expense.
  • Compression. Traffic between the browser/user-agent and Cloudflare can be compressed, reducing the amount of bandwidth required to transmit or receive requests.
  • Caching. If you upgrade to a paid plan, then you can customise Cloudflare to cache certain requests to improve performance or to take some load from your Cloudant service.
  • Analytics. You can see the statistics of which URLs are being hit.


That’s how easy it is to set up a custom domain for your Cloudant service. If you use Cloudant on Bluemix, the process is the same. (To reach your Cloudant dashboard from Bluemix, just open the service and click Launch.) Then follow the steps outlined in this post. Enjoy your new custom domain, along with all the benefits of Cloudflare.