How to mask a third party domain? - dns

I am hosting some videos on Google Drive.
Basically, I'd like to "mask" the download URL's of the videos with that of my own domain.
As of current, the links look like
https://drive.google.com/uc?id={id}&export=download
I'd like the links to be my example.com instead of google.com
At first, I tried inserting a cname record (eg. drive.mydomain.com -> drive.google.com) however, Google returns a 404 error in that case.
Can this be done?

In order to download a file from a server, the server must know the requested URL. If you add a CNAME record like yourdomain.com CNAME goole.com, the client will know the IP of the google server, but the requested URL will not be recegnized by the google web server, concequently will respond with a 404 error.
That said, there is no way to get a correct response from a server "masking" the domain name.
One workaround (maybe overkill), could be to create an script to temporary download the file from google to your server then send that file from your server to the final client.

Related

Origin for a CDN

I have some basic questions regarding configuring the CDN. I am using Amazon CloudFront for that.
1) Let's suppose my website is example.com. In the origin of cloudfront, do I mention example.com as the origin or create a CNAME like cdn.example.com which points to the server and then enter cdn.example.com as the origin?
2) Once the configuration is done, do I redirect example.com to the cloudfront domain like dxxxxxx.cloudfront.net?
3) I will update all the links in my website to http://dxxxxxx.cloudfront.net/xxx. Now when I browse example.com, I will be redirected to cloudfront. But cloudfront is also using the example.com as the origin. Isn't it like cloudfront is trying to pull data from itself? Won't that create a dead loop?
I am not able to get my head around this. I will be really grateful if someone could help. Thanks!!
Here is how it works.
Your website is at example.com where all the static files are hosted that you want to serve through Cloudfront. This example.com is called the Origin Server, Origin Host, or simply the Origin.
Cloudfront will create a Pull Zone for you that will look like http://dxxxxxx.cloudfront.net - Now you have to use this host instead of the original example.com for your static assets. All HTML files or dynamic files will still be loaded directly through example.com . Users will still enter example.com in their browser. Only the scripts, styles, images, fonts, icons and similar static files that are loaded by the browser behind the scenes are required to be changed to use the CDN host.
Your CDN setup is complete at this point. However, if someone looks at the source code of your page, they can see the cloudfront URLs being used to deliver static assets. This may look unprofessional. As a solution to hide 3rd party Host Name, and to use your own host name to get a branded feel, you can create a new subdomain cdn.example.com at your DNS provider and CNAME it to dxxxxxx.cloudfront.net
If you created a CNAME subdomain above, you now have to update all URLs of static files again, and change their URL to use cdn.example.com . Your website will still be loaded over example.com, but assets will now be delivered through cdn.example.com that will point to dxxxxxx.cloudfront.net
When dxxxxxx.cloudfront.net will receive request from browser for static files, it will forward that request to the specified origin server example.com where the files are actually placed. Origin will send the files to cloudfront, cloudfront will save the file for future use and will send a copy to the browser.
Step 3, and 4 are not part of the CDN integration process. Also, the subdomain cdn.example.com is not a requirement. You can use some other subdomain, or some other domain. For example, the following are valid:
cdn2.example.com
static-assets.example.com
static.assets.example.com
images.example.parent-company-website.com
Similarly, it is not a requirement to fetch assets from example.com only. You can specify my-other-website.net as origin, and cloudfront will happily fetch resources from there for your example.com site.
In your scenario, all of the following are not dependent on each other. You can change any or all of these and the process will not break providing you made necessary adjustments to the configuration and the code.
Your website: example.com
CDN origin: example.com (since currently assets are at this host)
Pull Zone: http://dxxxxxx.cloudfront.net/
CNAME Host: cdn.example.com
Hope this clears the picture.

Replace a image resource URl with my domain address

I don't know how exactly to explain my question.
I have a URL of image: http://hostimages.com/flower/images1.jpg. Now I want to replace this hostimages.com with my domain myhost.com. So the new URL will be like http://myhost.com/flower/images1.jpg
Is it possible to setup mydomain DNS like this? I already tried with CNAME and URL redirect, but not working.
If you can not host the image on your web host and to access it via the domain the other way I can think of is to create URL redirect, but with a path saving option, this way when you ask for http://myhost.com/flower/images1.jpg you will get http://myhost.com/flower/images1.jpg, but have in mind that you would probably need to create the redirect for a subdomain, if you have another service (like a web site) using http://myhost.com.
So probably it will be okay to create the redirect for images.myhost.com or resources.myhost.com

DNS redirect of a url to another url

We are currently looking at identifying the best approach to carry out a redirection of a url folder to another url folder o a separate domain. We have tried a few options but have been unable to make this work. Any other redirection options such as apache, html etc are not possible. This url is only accessed through the browser by an application to download some files. This application cannot be changed but needs to download these files from another location.
Hence, we need to redirect the following:
https://sub1.domain1.com/xyz
to
https://sub2.domain2.com/abc/xyz
Any ideas how we can achieve this?
Note: we have full control of DNS of the domain1 and there are no plans to use this domain.
You can't do that with DNS alone. The DNS never sees the "path" part of the URL. You need a webserver aware of the situation who can provide a 302 redirect.

Point subdomain to another domain in the server

I have a server with Plesk and CentOS.
http://cdn.oyunlar1.com/images/8836.jpg file is located in server A.
http://www.oyunlar1.com/modaokulu.html file is located in server B.
I basically want the same thing except I want to locate media files in a different domain instead of different server. Like this:
user visits cdn.mydomain.com/file.swf
but they actually read files from mydomain2.com/file.swf
I tried changing IP of A record of the subdomain to mydomain2.com's IP but it didn't work.
How can I do it?
Edit: I want to do this because it will help me to change my hosting provider very quickly and easily becuse media files are +100GB and the rest is like 10MB.
Solution was simply adding CNAME record to mydomain.com of mydomain2.com and using htaccess at mydomain2.

Make original site url name to some fake url name

I am new to rewrite site url name. I have a site url like http://66.15.101.250/test/ . this is my owned server link So i want to change this site url to something other name like http://testsite/test/ ( i do not want to give domain name to this ip address url).And i have otheres site running on this http://66.15.101.250/test/ server . I have no idea how to do this, what should i do.
Is this possible through .htaccess file or something else
Thanks in advance
Your server can only respond to requests it receives, and will only receive requests routed to it by DNS, so if you don't own the domain name, you can't receive public traffic directed towards it. You could silently redirect users from
http://66.15.101.250/test/ to the content found at http://testsite/test/ but they would still see the http://66.15.101.250/test/ url in their browser.
If you think about it, its a good thing you can't do this or I could make stealyourcreditcardinfo.com appear as paypal.com. Indeed most uses for what you are asking about would not be legitimate ones...
For your own internal testing purposes, you can make virtual host entry for testsite.com and your server will respond to any requests it receives for testsite.com. You then change your HOSTS file to point testsite.com to 127.0.0.1 and testsite.com will work in your browser, but only on your machine because you manually overrode your own DNS. The DNS everyone else is using is still pointing testsite.com to the actual IP address somewhere else
If you need this for testing purposes (as it seems to me), you can put 66.15.101.250 testsite in your hosts file and configure a virtual host for testsite in your webserver.

Resources