How to use wildcard domain with OpenShift hosting?

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:

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

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

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
HOST: www
POINT TO: appname-username.rhcloud.com

On Openshift
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.

Advertisements

What J talked about in 2013

The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 37,000 times in 2013. If it were a concert at Sydney Opera House, it would take about 14 sold-out performances for that many people to see it.

Click here to see the complete report.