openshift

How to use wildcard domain with OpenShift hosting?

If you have a domain name and want to use OpenShift for hosting then using a wildcard domain name is a bit tricky with some domain registrars like GoDaddy. The reason is IP address of the app on OpenShift doesn’t remain the same and to use the wildcard domain a DNS A record is setup with the IP address of the hosting server. So, how do we make sure the following is true:

  • user enters mysitename.com > user sees www.mysitename.com
  • user enters mysitename.com/about.html > user sees 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 the 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

http://appname-username.rhcloud.com.

This means the site is accessible at www.mysitename.com but not at mysitename.com. To make it work you need to do the following.

On domain registrar like GoDaddy
– Create a new Record with
Record Type CNAME
HOST: www
POINT TO: appname-username.rhcloud.com

  • Setup Forwarding
    Forward to: www.mysitename.com
    Redirect: 301 (Permanent)
    Type: Forward only

On Openshift
1. Select Application tab > select application appname-username.rhcloud.com > click change
2. Enter the Domain name www.mysitename.com

That’s it! Wait for 10-15 min and see the magic.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.