Question: I have a site hosted on [Openshift](http://openshift.redhat.com/) and it allows users to add domain name aliases using an external DNS provider. I'm using Cloudflare for my DNS. However, since Openshift's IP addresses are known to change, you have to use `CNAME` records instead of `A` records. (Bad, I know!)

However, this then breaks my `MX records` and I want to use my domain host's free email redirection service.

Is there any workaround for this problem?

Answer: 
From RFC 2181:

10.3. MX and NS records

The domain name used as the value of a NS resource record, or part of
 the value of a MX resource record must not be an alias. Not only is
 the specification clear on this point, but using an alias in either
 of these positions neither works as well as might be hoped, nor well
 fulfills the ambition that may have led to this approach. **This
 domain name must have as its value one or more address records.**
 Currently **those will be A records**, however in the future other record
 types giving addressing information may be acceptable. It can also
 have other RRs, **but never a CNAME RR**.

The reason for this is that you will need to do additional queries:

* ask the IP for the MX record -> CNAME
* ask the IP for this CNAME -> A record
* ask the IP for that A record -> finally the IP

This causes a lot of overhead
There is a workaround, like the guys in heroku state implicitly when talking about [avoiding naked domains](https://devcenter.heroku.com/articles/avoiding-naked-domains-dns-arecords). I have tried in OpenShift and it works the same.

1) If you own the domain `example.com`, create a subdomain `www.example.com`

2) Use `CNAME` records to alias `wwww.example.com` to `example-yournamespace-rhcloud.com`

3) Redirect permanently (301) `example.com` to `www.example.com`. For example, with `.htaccess`:

```
redirect 301 / http://www.example.com

```

4) You haven't touch `CNAME` neither `A` records, so you can configure freely your `MX` records.