CNAME setting displaying "Bad Request (400)"

History:

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

The CName setting is as follows: name-of-app.com redirects to www.name-of-app.com , www.name-of-app.com set 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 get the "Bad Request (400)" error.

I played with the following settings:

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

If I run the host command from my development station, I see that the alias is configured correctly.

cmd: host www.name-of-app.com (first 2 lines of output are listed below): www.name-of-app.com is an alias for name-of-app.rhcloud.com . name-of-app.rhcloud. com is an alias for ex-stand-nodeXXX.prod.rhcloud.com`.

I work with dns-provider.com , but so far there have been no problems.

Question:

How can I solve this CNAME problem? It seems that he is not in my power and out of my competence at the moment.

+6
source share
2 answers

Oddly enough, the problem turned out to be a Django-related issue (someone deleted the Django mailing list). Obviously, I did not provide enough information to know about this.

The problem is that CNAME was not enabled in my ALLOWED_HOSTS settings. By adding it to the ALLOWED_HOSTS setting, I was able to access the site as expected.

Greetings.

+5
source

@Ibn Saeed (I don’t have enough reputation to reply, with a comment) I had the same problem and decided to add the exact domain name to ALLOWED_HOSTS, leaving it that way

 ALLOWED_HOSTS = [ '.mydomain.com.', 'mydomain.com' ] 
+2
source

All Articles