Google Drive As A Content Delivery Network (CDN) For Your Website

After Google introduced Google Drive Site Publishing Feature, you can upload some static files like CSS, JavaScript, or Images to Google Drive and then use Google Drive as a kind of a free CDN (Content Delivery Network) for your website.

Rather than host your website's files on a single web server, you can distribute the website's static files and load across multiple server. This definitely will reduce the load of your server and greatly improve your page speed because the Google server has a lot more resources and respectable response times than typical shared hosting.

Actually when you follow this tutorial: How to Host JavaScript or CSS Files on Google Drive, the Google Drive already acts as a CDN for your website. But if you prefer shorter URL, something like http://cdn.domain.com/path/image.jpg or http://static.domain.com/path/style.css you can always create a sub-domain and redirect it to the "Public" folder on the Google Drive.
Note: This feature will not be available after August 31, 2016.

Please follow the steps below to create a free CDN using Google Drive:

Google Drive as a Free CDN



Step 1:
Create a new folder in Google Drive > Change the visibility settings to "Public on the web" > Upload some static web files > Get the folder id from the browser's address bar > And you can access your public folder at http://googledrive.com/host/folder-id

Or just watch this video, all steps are the same. The only difference is in the end you will get a list of files instead of a website.


Step 2:
Log in to your domain control panel (e.g. Namecheap) > Domain > Manage Domain > Select the  domain name > All Host Records > Create a new sub-domain > Click Save

Host Name: static
IP Address/URL: http://googledrive.com/host/folder-id
Record Type: URL Redirect
TTL: 1800

subdomain settings namecheap

Now you can use a URL like this http://static.domain.com/path/image.jpg to link your static website files. If you found this article helpful, then please share it with someone else by using the buttons below. Thank you!