Question

Background:

My Django app is located @ www.name-of-app.rhcloud.com Through dns-provider.com I own: www.name-of-app.com

The CName setup is as follows: name-of-app.com redirects to www.name-of-app.com, www.name-of-app.com is setup as a CNAME alias to www.name-of-app.rhcloud.com

Now if I try to access www.name-of-app.com from any browser I receive a 'Bad Request (400)' error.

I have played around with the following settings:

  • I can successfully redirect www.name-of-app.com to www.name-of-app.rhcloud.com, but then after switching back to a CNAME I am met with the same error.
  • I have added the necessary alias ala: rhc alias add www.name-of-app.com -a myApp
  • I have tried the steps of removing && then re-adding the above alias, to no effect.

If I run the host command from my devel station I see that the alias is correctly set up.

cmd: host www.name-of-app.com(first 2 lines of output are listed below):www.name-of-app.comis an alias forname-of-app.rhcloud.com.name-of-app.rhcloud.comis an alias forex-std-nodeXXX.prod.rhcloud.com`.

I am working with dns-provider.com, but they haven't raised any issues to this point.

Question:

How can I get this CNAME issue resolved? It seems to be out of my control and beyond my domain of expertise at the given moment.

Was it helpful?

Solution

Ironically enough the issue turned out to be a Django related problem (someone removed the Django mail list). Clearly I didn't provide enough information to know that however.

The issue lies in the fact that the CNAME was not enabled in my ALLOWED_HOSTS settings. Upon adding it to the ALLOWED_HOSTS setting, I was able to access the site as expected.

Cheers.

OTHER TIPS

@Ibn Saeed (I don' t have enough reputation to answer, with a comment) I had the same issue and solved it adding to ALLOWED_HOSTS the exact domain name leaving it like this

ALLOWED_HOSTS = [
    '.mydomain.com.',
    'mydomain.com'
]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top