CNAME setup displaying 'Bad Request (400)' - dns

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.

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.

#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'
]

Related

Deploying a custom domain with Heroku and Domain.com

I'm new to web dev and this would be my first proper deployment so apologies if this is a basic question. After following the steps on Heroku and Domain.com, my app is not showing at the desired url: www.rocketcreative.agency
Heroku
I've set up a basic web app (a draft version atm) on Heroku, and the code is working fine on https://hidden-sierra-22116.herokuapp.com . I've followed the Heroku instructions to generate a DNS target (cubic-orange-7jtaz36102kt9f8dir53koko.herokudns.com) for a domain I own (www.rocketcreative.agency) Heroku Dashboard Screenshot
Domain.com
I added the DNS target to Domain.com as a CNAME (with 'www' as the host name). I've waited 24 hours for the changes to propagate, and DNS checking sites indicate that the DNS has propagated. I've spoken to Domain.com support and they said everything appears to be set up correctly. Domain.com DNS Screenshot
Terminal:
In the terminal, when I input host www.rocketcreative.agency, it returns www.rocketcreative.agency is an alias for encircled-horseradish-4mpqnlzar9say364tz3hgy80.herokudns.com.
Browser Results for www.rocketcreative.agency
Safari: 'Safari Can't Find The Server'
Chrome: 'www.rocketcreative.agency’s server IP address could not be found. DNS_PROBE_FINISHED_NXDOMAIN'
I imagine this is a really basic question but if anybody could help that would be great. If there's any other info I need to provide please let me know. :)
Hold the phone! I've solved this one, but I'll leave the question up incase anybody encounters the same. Ran the Heroku DNS Diagnostic tool and there were some issues with https:// - fixed by running: heroku domains -a hidden-sierra-22116 heroku ps:resize web=hobby heroku certs:auto:enable heroku certs:auto It said 'cert issued' and now the url works

Heroku App with Namecheap Domain Not Working

I have tried everything that has already been suggested on this site and others.
The Normal Way
Add my domain website.info to Heroku's "Domains and certificates".
Change the CNAME record to website.info.herokudns.com with the host www.
Leave the redirect record to be Host #, http://www.website.info.
Result:
"No Such App" comes up for Heroku.
The WWW way
The same thing as normal, except I added www.website.info to Heroku and removed website.info.
"This site can't be reached. www.website.info's server IP address could not be found."
Adding through the CLI
Installing heroku cli to my Git Bash: npm install -g heroku-cli
I try heroku domains:add website.info -a websiteapp.
"Domain already added to this app."
Tried accessing it. Same thing: "No Such App".
Removing the Redirect
Same thing as the normal way, just without the redirect.
"This website.info page can't be found" HTTP ERROR 404
I used to do this all the time when I was learning how to build web apps. Worked flawlessly. Did Heroku change something for free dynos? Do I need to run SSL or something?
At the very least, I can redirect the domain to the website.herokuapp.com domain, but I would rather not do that.
I've just had the same issue and tried all the methods you have tried plus more. In the end how got my custom domain to work was to set my namecheap Domain settings to Custom DNS.
elle.ns.cloudflare.com
rudy.ns.cloudflare.com
From there i used the www.customdomain.com format on heroku and set the rest up on Cloudflare as follows:
On the DNS Tab
Type Name Content TTL Proxy status
CNAME www myapp.herokuapp.com Auto Proxied
On the SSL/TLS Tab select Full
On the Page Rules Tab
If the URL matches:
customdomain.com/
Then the settings are:
Forwarding URL
301 - Permanent Redirect
/www.customdomain.com
After i applied those settings everything worked perfectly. I hope this can help anyone facing this issue in the future.

Why all *.dev domains target to my localhost?

When you type *.dev domains, for example juas.dev it points to localhost, someone know why ?
(My hosts are not modified, and the request dont go outside)
I have just suffered this exact issue and it was driving me crazy. I couldn't access any .dev domains on the web. Trying to load a .dev website was causing a security warning in Chrome because it was using a default self-signed certificate somewhere on my machine, resolving all .dev domains to 127.0.0.1.
If your operating system is Mac OS X, this might solve it, as it worked for me.
In Terminal, type this command:
cd /etc/resolver/ && ls
If you see an entry name dev when you hit the Enter key, then chances are this is a wildcard resolver pointing all your attempts to access .dev domains to 127.0.0.1, ie. localhost.
Simply renaming this gets rid of it. You need admin permissions so (assuming you are still in /etc/resolver/) run this command:
sudo mv dev dev.ignore
You should instantly be able to access .dev domains on the web.
If moving it doesn't work, you can try deleting it with sudo rm dev as a last resort.
Do a lookup for a TXT record at that name and things will become clearer :-)
.DEV is a recently registered top-level domain, and currently in an initial period where it's seeded with data meant to alert people using it privately that they're about to have a problem. Part of that is to return only the address 127.0.53.53, which is special enough to be obvious in log files and similar, but also in the 127.0.0.0/8 block that is defined as loopback for IPv4. Which is why you get your own machine. In a few months or so, you'll almost certainly start getting NXDOMAINs instead.

domain name does not open the website, redirects to default IP instead of opening www

I recently changed NS of one domain to another host and created a domain using Helm Control Panel.
The problem is that when I type domain name (ie. www.MyDomain.com) instead of opening the coresponding website, it opens host webmail page which is served by smarter mail.
I have cleared dns cache, rebuilt and updated it. also I removed the domain and added it again.
Pinging the domain name returns server's IP address and it's up.
The hosting OS is windows server 2003.
I appreciate any comments to solve the problem.
Edit 1:
Though this was a long last headache, I solved the problem by removing domain's DNS entry alongside with all alias domains attached to it directly in DNS Server console, restarting server and then rebuilding DNS Zone via Helm Control Panel. I'm not sure if this was the best practice but it seems there was a mix of domain's DNS, alias domains' DNS, Hosting software, Caching problems.
Edit 2:
Actually this error was not about the DNS stuff, it is a failure of Helm Control Panel adding/removing alias domains. To share the experience, I Add a answer to this question.
This was not a DNS error.
I found the answer when examining IIS where i noticed the website was stopped.
Forcing the website to start, this error message poped up:
IIS was unable to start the site, another site may already be using the port you configured for this site.
Further investigation revealed that one same domain alias has previously added to another domain/host.
Removing this alias from IIS > Website Properties > Website > Advanced > Advanced Website Identification, fixed the problem.
What led me to assume a dns problem mistakenly was that default IP of server is set to mail server by default. so, when a website is stopped the domain points to mail server.
Hope this help for future.

Setup CNAME alias from one domain to another

I'm attempting to satisfy the Cookieless domain suggestion of Google's Page Speed plugin and am running into a wall with my host who can't be bothered with the details of why it's not working. Accessing st1.dgcstatic.com should be the same as accessing st1.defunctgames.com; however, this is not the case.
Have I missed a step of configuration? Do I need to wait for DNS propagation? You can see below my steps of experimentation.
DNS Setup:
Created CNAME of st1.dgcstatic.com to point to st1.defunctgames.com on dgcstatic.com
Created A record of st1.defunctgames.com on defunctgames.com
Created sub-domain of st1.defunctgames.com on defunctgames.com
When I run a tracert st1.dgcstatic.com it produces the following result:
C:\Users\Patrick>tracert st1.dgcstatic.com
Tracing route to st1.defunctgames.com [50.22.11.10]
When I run a host st1.dgcstatic.com it produces the following result:
patrick:~ patrick$ host st1.dgcstatic.com
st1.dgcstatic.com is an alias for st1.defunctgames.com.
st1.defunctgames.com has address 50.22.11.10
And finally, using this site it seems to produce the same results of showing things configured correctly.
http://www.mxtoolbox.com/SuperTool.aspx?action=mx%3ast1.dgcstatic.com
According to all these results, the world can see my DNS changes, my host on the other hand gave me the "Wait for propagation" rigmarole When asked why this isn't working.
It looks to me that your domain names are set up correctly (st1.dgcstatic.com is an alias of st1.defunctgames.com), but the web host needs to have a mapping or configuration to know how to serve st1.dgcstatic.com content.
Both domains are resolving to 50.22.11.10, but that is most likely a shared IP address host. (Visiting http://50.22.11.10 demonstrates that it's shared - it can't resolve to your site just by the IP address.)
You'll need to configure through your webhost provider the second domain. Hosting companies do this differently; in my case it's just a matter of adding a new domain to my account (extra $1/mo), and configuring the path for HTML source files.

Resources