-4

We maintain links to the documents coming from the following 3 sources.

1. docs.abc.com
2. docs.def.com
3. docs.ghi.com

But we do not give a direct link to the user. So we give the links to the documents, like the following.

docs.mysite.com/abc/other-link-info

docs.mysite.com/def/other-link-info

docs.mysite.com/ghi/other-link-info

So when user's browser tries to access the link, browser hits our site docs.mysite.com and we have two approaches on how to serve the documents.

Approach 1: For each link, we will compute the actual link (source link) of the document and download the document from the source link. We will then stream the document to user.

The downside of this approach is that there is a load and bandwidth usage on the server.

Approach 2: Create 3 CNAME aliases, the following way so that the documents are served automatically.

docs.mysite.com/abc => docs.abc.com
docs.mysite.com/def => docs.def.com
docs.mysite.com/ghi => docs.ghi.com

The advantage is that there is no load and bandwidth usage on the server. But I am not sure whether this approach is possible.

One side question: If we create a CNAME alias like docs.xyz.com pointing to mybucket.s3.amazonaws.com, does the end user gets to know the source link or where we stored our documents. We do not want the end user know where we stored the documents, and a lot of times those documents are not ours.

Another side question: If we have a CNAME alias like docs.xyz.com pointing to mybucket.s3.amazonaws.com, can we MX records and other records on xyz.com domain?

Thank you very much for taking time to read this.

closed as off-topic by Andrew B, fukawi2, HopelessN00b Mar 5 '15 at 6:24

  • This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    This question is not DNS related. – Esa Jokinen Mar 4 '15 at 23:33
  • Can you tell me what is this related to and I will tag it appropriately? – Mohan Gundlapalli Mar 4 '15 at 23:40
  • This is related to web servers and http redirects. With DNS records you cannot affect on how the target site will handle the requests. – Esa Jokinen Mar 4 '15 at 23:47
  • No, I am not talking about how the target site handles the requests. I am talking about how my site needs to handle and possibly with the help of DNS CNAME aliases. If you have given a down vote, it is not helping my genuine question. – Mohan Gundlapalli Mar 4 '15 at 23:56
  • 1
    With CNAME record the browser will ask mybucket.s3.amazonaws.com to server pages from domain docs.xyz.com which it doesn't recognize at all, so this is not DNS related question and CNAME records doesn't offer any solution to the use case described. – Esa Jokinen Mar 5 '15 at 0:00
1

As explained, this cannot be achieved via DNS settings.

But your approach #1 can be improved by making the docs.mysite.com server cache the files that it retrieves from the origin server, and serve those cached files from its own storage.

With nginx you can use proxy_cache to establish caching of the proxied content from the origin servers.

  • I was 90% convinced that I had to go with the approach #1, but only problem is it is resource intensive and consumes bandwidth. I posted to this forum to see whether brilliant people out here can provide some insight to improve my solution. As it turns out, this is no other way. It is pretty discouraging how people convey this. Thank you for your time. – Mohan Gundlapalli Mar 10 '15 at 13:21
2

No, this will not work. DNS is protocol agnostic. You can setup a webserver to take those, and redirect to the link you want to send your users to.

  • If I redirect the links, then the end user knows the actual link to the document. So I want to avoid doing that. – Mohan Gundlapalli Mar 4 '15 at 23:58
  • This is still the correct answer to your question, as it is phrased. – Andrew B Mar 5 '15 at 0:16
1

No, you cannot. That is very simply not what a CNAME does.

foo.example.com. can be CNAME

http://foo.example.com/ cannot be a CNAME

http://foo.example.com/bar cannot be a CNAME

CNAME aliases one DNS label to another. A URL is NOT a DNS label. And for the record, a URL is NOT a domain.

  • 1
    This is one of the answers I was looking for. This helps clarify what a CNAME is. Thanks. – Mohan Gundlapalli Mar 10 '15 at 13:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.