If you have a domain name and want to use OpenShift for hosting then using wildcard domain name is bit tricky with some domain registrars like GoDaddy. The reason is IP address of app on OpenShift doesn’t remain same and to use wildcard domain a DNS A record is setup with the IP address of hosting server. So, how do we make sure following to be true:
- user enters mysitename.com > user sees http://www.mysitename.com
- user enters mysitename.com/about.html > user sees http://www.mysitename.com/about.html
That is, the www prefix is always displayed anywhere on the site.
But due to the non-static IP of OpenShift app it is not possible to adjust the A record. But you can set up a cname with the following:
www > appname-username.rhcloud.com
where the format for the OpenShift app is
This means the site is accessible at http://www.mysitename.com but not at mysitename.com. To make it work you need to do the following.
On domain registrar like GoDaddy
– Create new Record with
Record Type CNAME
POINT TO: appname-username.rhcloud.com
- Setup Forwarding
Forward to: http://www.mysitename.com
Redirect: 301 (Permanent)
Type: Forward only
1. Select Application tab > select application appname-username.rhcloud.com > click change
2. Enter Domain name http://www.mysitename.com
That’s it! Wait for 10-15 min and see the magic.