CNAME setup displaying 'Bad Request (400)'
Asked Answered
E

2

7

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.

Erased answered 18/12, 2013 at 15:57 Comment(1)
Do not vandalise your posts please.Raving
E
7

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.

Erased answered 19/12, 2013 at 7:51 Comment(2)
I am having the same problem, can you elaborate a bit on how you solved it. I have added my domain in ALLOWED_HOSTS '.mydomain.com', but its still gives a 400 error message.Lionel
Should ALLOWED_HOSTS = ["*"] fix this problem? It seems to persist for me event with this.Burns
H
3

@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'
]
Hepcat answered 13/2, 2016 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.