Azure CDN using root domain solution - azure

I have a concern with our CDN as we are planning to apply custom domain. I understand the part that it is not possible to map a CNAME record to a root domain, such as contoso.com. I want to ask for a workaround, let us say yes we already assigned it to www.contoso.com. But people now adays do not use the www subdomain anymore and will just type constoso.com in the URL address bar and therefore it will just return a 404 because it is not mapped making as lose potential customers. What is your suggested solution or workaround for this?

Some DNS hosts allow creating CNAMES for root domains (ANAMES).
If your DNS host doesn't allow that then you can try to use subdomain redirection (like simple node.js app hosted on azure). Not the best solution but I'm not sure if other exists.

The work around is to use the cdnverify CNAME feature with A record.
CNAME : cdnverify.constoso.com -> cdnverify.constoso.azureedge.net
A record: constoso.com -> x.x.x.x
After all verification is complete, the CNAME can be removed. It worked for my domain.
(source: https://arlanblogs.alvarnet.com/adding-a-root-domain-to-azure-cdn-endpoint/)

There is currently no solution for this, except the described workaround when your domain-provider supports this.
There is a feature request on Azure for this problem:
https://feedback.azure.com/forums/217313-networking/suggestions/31221439-cdn-allow-root-domain-for-custom-domains

Related

Point sub domain to root AND redirect main domain

I have
'website.com' and 'newwebsite.com', both on LAMP environment.
I need
website.com redirecting to newwebsite.com
AND
old.website.com pointing to root of website.com
I have full control of both hosting and DNS records.
I can't figure out the best solution without creating a loop !
There are two choices here: redirects, or DNS records. If you do it with redirects it means the user will see that they have been forwarded elsewhere. If you use DNS, the user will not be aware of the deprecation of the old websites.
For this reason, I would use HTTP redirects for this task.
If you wanted to go the DNS route then simply have an A record for newwebsite.com and CNAMES for the others that point to it.

Redirect subdomain on CloudFlare to Google Calendar

I want to redirect a subdomain of a domain I have on CloudFlare, to a Google Calendar (HTML/embed version).
I assumed I needed to use Page Rules to do this, which I have done by following CloudFlare’s documentation. However just following these instructions did not work for me. Apparently I need to add the subdomain to my DNS records on CloudFlare, but I don’t know how to set this up correctly since I have no server or IP to point it to (or I’m just confused as to why I need to even point it to something when I just want to forward a URL).
As mentioned I have no server to point it to – and thus can’t use a .htaccess solution – so don’t know what record type I should be using to use to just have the redirect working
I've had some success just using google.com as the CNAME record, then using a Page Rule to redirect everything on that domain. Because CloudFlare changes the DNS entry to its servers anyway (when you do the orange cloud thing) nobody will know.
I don't know if you could do that directly from cloudflare, but you can solve this using your hosting.
Point subdomain to your hosting server sub IN A 1.2.3.4 via cloudflare
Create sub.domain.com on you hosting
Place redirection script in index file in subdomain sub.domain.com document root:
<?php
header( "Location: http://docs.google.com/your-url-and-so-on" ) ;
?>
"subdomain to my DNS records on CloudFlare, but I don’t know how to set this up correctly since I have no server or IP to point it to"
This doesn't make much sense. A subdomain has to point to a record of some sort (A record or CNAME), so the subdomain wouldn't resolve without a record type of some sort. In order for a PageRule to work, two things have to happen:
The record has to be in your DNS settings.
The record has to have our proxy running over it.
It might be easier to figure out with the actual subdomain in question & what you're trying to forward to specifically.
So CloudFlare does support this through PageRules, you just need to get the URL correct.

GitHub Pages: setting up custom domain

I've got an organization page set up and running in GitHub and things seem to be working...but I'm a little confused. I'd like to actually understand the process since the GitHub Help article refers to taking advantage of their CDN and DoS services, so bear with me.
Step 1: Created CNAME file in repo with domain 'example.com'
Step 2: Grabbed IP from dig example.github.io +nostats +nocomments +nocmd
Step 3: Entered IP from Step 2 into the 'A' record (see image below)
I decided to stop here and see where it got me, and to my surprise it seems to have done the trick. The example.github.io domain correctly redirects to the example.com domain and displays the content from the repo.
However I was informed that after the DNS props, you can dig example.com and see the CNAME record pointing to example.github.io. I do not see this, and I dislike thinking that I didn't set things up correctly. Any thoughts/comments/tips welcome, thanks!
In order to take advantage of the CDN and DoS services provided by GitHub Pages, you'll need to set up a Subdomain (eg www.example.com or blog.example.com) instead of an Apex domain (example.com).
From the GitHub Help page you referenced:
If you are using an apex domain (example.com) instead of a subdomain
(www.example.com) and your DNS provider does not support ALIAS
records, then your only option is to use A records for your DNS. This
will not give you the benefit of our Content Delivery Network.
Here's a setup (looks like you're using GoDaddy for DNS) that would work to get your Organization Pages working as desired:
This is actually for a Project Page within an Organization, but for either one, you'll set the CNAME record for www to organization.github.io, not something like organization.github.io/project. Don't change the A record for # (mine is the default from GoDaddy).
If you want to get your Apex domain (example.com) to redirect to the new subdomain (www.example.com), then you can point your Apex to your subdomain with Domain Forwarding like this:
With that setup, you'll get to take advantage of GitHub's CDN, which you may notice is provided through fastly. Here's how my domain looks to dig:
It is also possible to use a CNAME record for an APEX domain using the free DNS service provided by CloudFlare in which case you can also use your domain without the www (or any other subdomain) and still benefit from CDN & DoS.
I've written a step-by-step guide here: Speed up your GitHub Pages website with CloudFlare
PS: Apparently using ALIAS records is a bad idea... click here to see why.
DNS records are publicly available. There's no way of masking them in this instance. From the way you describe it, you have done everything right. There is nothing that makes me thing you set this up incorrectly.

How will a CNAME DNS affect Google Engine

I'm hosting a clients site at client.mysite.com, but my client want to have its own domain, like www.clientsite.com.
With a CNAME configuration, I'll be able to hook my client domain to the content, but... considering I'm still hosting my clients content, which domain will be finally listed on Google with contents of client.mysite.com contents?
a) mysite.com
b) clientsite.com
Thanks for helping.
In the DNS hierarchy, the CNAME resource record will be attached to the clientside.com. A CNAME is simply a reference to the location of that site's A record. With that in mind, I believe mysite.com will be listed as hosting the data.
Does your client want it to appear under his name?
If so, then this should not be solved using DNS (well, not only using DNS).
If your client wants to get the content listed under his domain name, the best way to do this, is to add their name to your server.
Then point client domain name to your server.
The best way to do the pointing (when also considering SEO)
is to make an webforward (301 permanent) from the root, to the www
and make the www subdomain point to the ressource.
(Or vice verca)
IF you are using the example above (webforward on root) you can use a cname instead of an A record to point the domain name. However do not add a cname to the root of a domain (effectively shutting down your domain name).
So-
Short Answer:
client.mysite.com will have the content (also according to google).
Any attempt to obfuscate this is black hat or grey hat ;)
a better way of doing it is to simply setup the clients domain name on your server.
Then point only one hostname to the server. Server host/headers will take care of the rest.
Setup in DNS
# webforward 301 www
www a or Cname to server
Quick rules:
NEVER put Cname on the root of a domain
Only allow 1 hostname to show content (can be done both as explained above via DNS/webforward or via server configurations)

Using DNS to redirect to another URL with a path [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I'm trying to redirect a domain to another via DNS.
I know that using IN CNAME it's posible.
www.proof.com IN CNAME www.proof-two.com.
What i need is a redirection with a path. When someone types www.proof.com, it should take them to to www.proof-two.com/path/index.htm
I know it can be done using Web Server facilities, but I need DNS redirection.
Is this possible?
No, what you ask is not possible. DNS is name resolution system and knows nothing about HTTP.
if you use AWS, a redirect like
mail.foo.com --> mail.google.com/a/foo.com
can be setup as follows:
in s3, create an empty bucket "mail.foo.com"
under Properties -> Static Website Hosting, set "redirect all requests to: mail.google.com/a/foo.com"
in route53, create an A record "mail.foo.com"
enable "alias", and set alias target to the "mail.foo.com" bucket
not a pure DNS solution, but it works ;)
But be aware of, the redirect skips all the URL parameters e.g.: ...?param1=value1&param2=value2
I realize this is an old thread but FWIW, incase someone else is looking for a way to do this.
While dns does not understand the path portion of the url, it will understand subdomains, so instead of:
www.proof.com IN CNAME www.proof-two.com/path/index.htm
You could use:
www.proof.com IN CNAME proof.proof-two.com
then go to wherever you host proof-two.com and set it to point proof.proof-two.com to www.proof-two.com/path/index.htm.
~ there's always more than one way to skin a cat
Some providers allow this but there are no "pure" DNS solutions since DNS doesn't know anything about the protocol you're using and redirects are a feature from HTTP.
For OVH, see : https://docs.ovh.com/gb/en/domains/redirect-domain-name/
You will have to use the control panel to add your redirection. It will update your DNS zone accordingly.
Let's consider you created a redirection from foo.bar.com to foo2.bar.com/path. OVH keeps the url paths and parameters. So if you try to access foo.bar.com/hello?foo=bar, you'll be redirected to foo2.bar.com/path/hello?foo=bar.
I have a personal project that might help you in solving this issue.
It's an open source redirect solution that allows you to redirect your domain just changing your DNS settings. Link of the project: https://redirect.center/.
To redirect www.proof.com to www.proof-two.com keeping the URL parameters, just set your www DNS entry on proof.com:
www.proof.com IN CNAME www.proof-two.com.opts-uri.redirect.center.
Really it's easy with redirect.center
If you want create a CNAME as :
www.proof.com IN CNAME www.proof-two.com/path/index.htm
using redirect.center your CNAME look as canonical mode as:
www.proof.com IN CNAME www.proof-two.com.opts-slash.path.opts-slash.index.htm.redirect.center.
Now if you want redirect to https website you can add this option:
www.proof.com IN CNAME www.proof-two.com.opts-slash.path.opts-slash.index.htm.opts-https.redirect.center.
Now you can create a CNAME with the canonical mode with slash in your destiny page.
To answer the original question, no, what you want is not possible using only DNS (like everyone has stated). In addition to everything mentioned already, another option is to use a URL redirection service. These types of services can enable you to configure many different types of URL redirects depending on your needs. For example:
Forward a domain apex to a www. subdomain or vice versa
Forward a collection of domain names to a single destination (useful for forwarding domain misspellings, old company names, etc.)
Forward specific domain names to deeply linked pages (like what the OP wants)
A service that does this is EasyRedir. Full disclosure: I developed EasyRedir. There are certainly other options out there though, so I encourage you to have a look around.
DNS won't redirect the path portion of a URL, so that won't be possible.
Adding
www.proof.com IN CNAME www.proof-two.com
will direct access to www.proof.com to www.proof-two.com, where you will need to use web server config to direct users to the appropriate page.
A related work concluded all the below:
Problem:
http://a.com/p1/p2.html should go to http://B.com/p1/p2.html
today, but later when configured manually/automatically, the same
http://a.com/p1/p2.html should go to http://C.com/p1/p2.html
Answers:
DNS - converts name to IP address
Though it can do a lot of redirects, always output is IP address
DNS does not understand the path or protocol part of URL, understands domain part only, that is, a.com only is converted to IP address, so when you hit http://a.com/p1/p2.html may be converted to http://152.132.121.11/p1/p2.html
if you configure wrong in DNS, then you will get 152.132.121.11 (not http://152.132.121.11/p1/p2.html), so you would get some 400s error (400, 403, etc.)
Redirection - this is http://a.com/p1/p2.html can be converted to http://b.com/p1/p2.html
All the methods like GET, POST can work, with if any headers and body, but there is a web server is involved, it could be point of failure, so scalability and availability will be key
If you are on AWS, Route 53 -> API Gateway is possible though custom domains, internally using the Cloud front
It is possible with Amazon Certification Manager, AWS Gateway custom domains & Route53, note the us-east-1 restriction on ACM
Hope that helps someone
I will suppose you have this scenario: You have a unique webserver hosting various websites, each one is supposed to be presented by a separated domain:
http://example.com/customer1/website/page1.html
http://example.com/customer2/website/page2.html
so, the page1.html should be served by www.customer1.com and so on.
create a subdomain inside the example.com dns server (your webserver):
customer1.example.com
in your apache virtual server settings, map the subdomain to the directory that contain the web site for your customer #1, like this:
<VirtualHost *:80>
SetEnv PAGE_ID "customer1"
ServerName customer1.example.com
ServerAlias www.customer1.com
DocumentRoot /your/local/path/webserver/customer1
</VirtualHost>
please note the value for "ServerAlias", it is important for the next step-
at this point, you should be able to navigate to your customer1 website by browsing to:
customer1.example.com
In the DNS settings for customer1.com you must make a CNAME record:
CNAME=www
LOCATION=customer1.example.com
Now, you're enabled to use: www.customer1.com.
My solution to this problem was pretty simple and straight forward. All you need is an IIS server running inside the domain.
Setup CNAME in DNS to point to the IIS server, using host names in IIS to resolve several sites on a single IIS server. I'm using the same IIS server to farm out a few sub domains to external sites.
Then in IIS setup setup redirection for that site to go to your offsite site/path, in my case it was our hosted catalog that I wanted catalog.ourdomain.com to go to. From here all the tweaking is done in IIS. Be sure to enable anonymous authentication so traffic will not be blocked.
While as almost everyone stated already - it's impossible using just DNS. As a workaround I would suggest trying NGINX (http://nginx.org/en/docs/http/request_processing.html).
TL;DR - In NGINX you can create multiple virtual servers that can redirect your request based on the server name.
Ex. http://first.my-server.com redirect to place A and http://second.my-server.com redirect to place B, while both share a single physical server.
You can use htaccess rewrite mod, rewrite to the subfolder if the user is requesting one specific domain not the other.
Of course it is possible to redirect, with the following trick:
Create a new standard primary zone
Name it same as the fictive URL that you want to redirect to
Ensure that this fictive name is different than any AD DNS name
Create A record with following entries:
blank.......................A............................ip-addr-2
www.........................A............................ip-addr-2
What we have here is redirection, essentially. A valid URL will resolve based on the existing DNS primary DNS zone. A fictive URL will be redirected to ip-addr-2. What is important is that the name of this entry is blank, so it will fall down to the next entry in the record and redirect to ip-addr-2
Everyone has already stated this, and I just want to give you another option to a service that can help you. www.301redirect.it is a free service that can redirect your domain (with wildcard) to any destination url.
I want to add a disclosure as well: I'm the developer behind this service and there is a other options out there.

Resources