how to connect cloudflare root domain to AWS Elastic Beanstalk - dns

I wish to setup Cloudflare so that both mydomain.com and www.mydomain.com will reach the same Elastic Beanstalk host.
I've created a CNAME for the "www" subdomain, it works great.
But how do I handle the mydomain.com DNS root entry? It's currently an A record, pointing to some IP, but in order to point to EB, I need to have a CNAME like "www", correct? If so, is it safe to somehow replace the A record with a CNAME despite the fact this is a root DNS entry rather than some subdomain..
thanks.

All you need to do is add a Page Rule
Match: mydomain.com/* and Redirect (301) to https://www.mydomain.com/$1
Or http if you’re not using SSL. The $1 means to copy the path from the original request.

Delete the A record from Cloudflare DNS Panel
Add a record with type CNAME and value as yourdomainname.com
This doesn't work on most DNS providers. However, Cloudflare has a feature called "CNAME flattening" that allows a CNAME Record to co-exist with other records at a domain's root. In practice, it doesn't act like a CNAME because when someone looks it up, Cloudflare resolves it internally, finds an A Record and returns the value. (This is how Alias A Records work on AWS Route 53, for example.)

Related

How can I route my subdomain in AWS to Zendesk

I have a domain, hosted zone in AWS, lets say its example.com
I've tried adding a CNAME record for subdomain support.example.com which points to example.zendesk.com/hc/en-us
It is not redirecting to my Zendesk landing page.
How can i get my subdomain to point to zendesk?
This is not how CNAMES or DNS would work.
A CNAME record can only point to a different A Record entry.
So for your example.com the valid CNAME entry for your DNS record can only be example.zendesk.com and you can not add the '/ch/en-us' part.
Have you looked at the Zendesk support system to see what they have to say that you should be adding to your DNS?
Looks like they call it Host Mapping
https://support.zendesk.com/hc/en-us/articles/203664356-Host-mapping-Changing-the-URL-of-your-help-center

DNS: forward root domain to www... when there are other DNS subdomains

I currently have a DNS setup where all content and applications are hosted on the same cloud server - example.com.
The presentation website is on example.com, www is forwarded to example.com with a CNAME and then various internal apps, eg app.example.com, are also forwarded with CNAME records to example.com. NGINX running on my server takes it from there, routing subdomains to the different apps.
I'd like to host the presentational website on an external service, and I'm confused about how to update my DNS config - specifically what to do with my A record.
I'm ok with creating a CNAME for www that will forward www.example.com to my external hosting service. But example.com is still pointing to my own server... and if I have understood correctly, if I forward example.com to www.example.com, then all my apps at eg app.example.com will break.
What are my options for handling this ?
My idea (from searching around) is that if I want example.com to point to an external service, then I should
1) create a new domain api-example.com whose A record points to a server where all my apps are hosted
2) make CNAME records for all my app subdomains on example.com which point to api-example.com
3) forward example.com to www.example.com, and forward www.example.com to the external service.
Will this configuration work ? Is there a simpler way to get the same result ?
Your plan is fine, except for maybe one thing: generally, you can't have a CNAME record for the root (apex) of your domain. This means that your external presentation website hosting will have to provide an IP address, and you will create an A record that will point example.com to that address. Then you can have a CNAME record simply aliasing www.example.com to example.com.
Also make sure that you leave enough time between the steps, to make sure that all DNS TTLs expired so you don't encounter DNS caching issues.
For explanation (and possible workarounds) for domain apex CNAMEing issue, look at https://stackoverflow.com/a/33027309/1145196

Cloudflare DNS - How to redirect all subdomains to root domain?

Can somebody tell me how I can redirect all subdomains to the root domain in Cloudflare DNS?
I have been looking for a day now without any luck.
I can't use .htaccess because all the subdomains doesn't resolve (They look just like a root domain that haven't propagated) and doesn't return anything, and I don't want to set up hundreds of DNS records for each possible subdomains.
I would like to set up a wildcard dns entry to redirect or at least make all subdomains reachable, so I can either do the rest via the .htaccess, or through DNS.
So how do I make the DNS entry for above requirements?
Thanks.
From the support: Does Cloudflare support wildcard DNS entries?
Cloudflare Free, Pro and Business plan:
We do not proxy wildcard records so these subdomains will be served
directly without Cloudflare performance, security, or apps. The
wildcard domain will have no cloud (orange or grey) on the Cloudflare
DNS Settings page for that reason. If you are adding a * CNAME or A
Record you need to make sure the record is grey clouded in order for
the record to be created.
To get Cloudflare protection on a wildcard subdomain (for example:
www), you explicitly have to define that record in your Cloudflare DNS
settings. First, log into your Cloudflare account and select the DNS
icon. In this example, you would add "www" as its own CNAME record on
your Cloudflare DNS Settings page and toggle the cloud to orange so
the Cloudflare's proxy is enabled.
Unless you are an Enterprise customer, you can't use a wildcard to redirect through Cloudflare.
Make sure the cloud logo is grey to add a wildcard record:

Domain without WWW on Cloudflare?

I created an app on Openshift and added aliases.
My registrar doesn't allow me to add a CNAME without WWW. So I started using the Cloudflare DNS servers and added 2 CNAME records. In the records page it looks like this:
CNAME porta8080.com.br is an alias of blog-porta8080.rhcloud.com Automatic
CNAME www is an alias of blog-porta8080.rhcloud.com Automatic
I changed it like 3 or 4 ours ago and the domain status is already Active.
If I go to my website it won't be displayed if I omit the subdomain www. . But works well with www.
I wonder if I can do this with Cloudflare (with and without www.) and/or cloudflare is alrady routing for me. I got a free plan.
Thank you
#edit
Now I got a ERR_TOO_MANY_REDIRECTS error. Any ideas on what could this be?
CloudFlare Partner set-ups usually are done via a CNAME set-up. Unfortunately it doesn't strictly comply with an RFC to support a CNAME record on a root domain, accordingly you can either set-up your own CloudFlare account (you won't get RailGun if your host are not just a normal CloudFlare Partner but an Optimised Partner).
The way around this is either get them to support the Full Host set-up which CloudFlare now support or set-up your own CloudFlare account and use a nameserver install.

very simple -- how do i setup a subdomain with 1&1 domain provider + hostgator hosting?

Everytime I try to create a subdomain with this combo, it simply says the page doesn't exist. I have the subdomain directory created, so I'm not sure what I'm doing wrong. for example if I want
subdomain.domain.com, then
domain.com/subdomain will work, but
subdomain.domain.com won't work.
Any insight?
Firstly you will need a DNS record for you subdomain. This can be a CNAME record if you just want the the subdomain to be an alias of the main domain (Canonical Name). If you want the subdomain to be hosted on a different IP address or server then you need a new A record.
From the sounds of it you want a CNAME record for your subdomain created in your DNS manager, and then you want to configure your web server to look at the host headers to map to the sub directory you created. How you go about this depends on the type of web server.

Resources