CDN Content URL's being stripped
Hello, after following the instructions per the docs here docs.sitefinity.com/use-cdn-for-your-blob-storage-providers, I was able to configure my site to use MaxCDN hosting for content delivery. I changed an image library that contains only 1 image to use the CDN blob provider, placed the image on a page by itself, and tested it. The url-CDN is being written out, however, the url that replaces the src tag on the image is using a relative path (image). Instead of http://maxcdn or simply //maxcdn, the url contains no protocol, and so our website is treating this url like a relative path, similar to "mysite.com/.../maxcdn...". I do not see any references in any of the corresponding CDN documentation regarding any form of URL rewriting and I have followed these instructions time and time again to ensure their accuracy.
Is there some sort of issue with utilizing CDN for images, or is there another option I need to set?
When I try to manually add the http:// into the generic content control the image is placed in, it is removed again upon saving (because Sitefinity does this, normal behavior). If I remove the sfref tag and add the http://, it works. We were hoping to preserve our library of images to choose from and still take advantage of the CDN, but even in the image-chooser dialog the images display suffer from the same problem above and display as broken links.
Thanks.
Edit: Added an image showing the 404 received from Sitefinity treating the URL like a relative path (404-relative-path.png).
Edit 2: Added image of Blob Provider CDN settings (CDN-Settings.png).
Hi Marcus,
Judging by the provided information Sitefinity offers you two different solutions. The first one being the usage of CDN (mentioned by you) and the second one external blob services such as Amazon S3 or Rackspace CloudFiles.
In the case of using an external storage provider such Azure Blob Storage you offload the storage of the files to the external service - more precisely storing the binary data of the media item, excluding its thumbnails. Since however external storage services have their own URLs for the blob items being stored Sitefinity will not not serve the items through its URLs but will rather serve them through the URLs provided by the storage service. Therefore you will offload processing of media content requests to the storage service.
In the case of CDN usage however Sitefinity still retains the management of the media items - they are stored according to your settings for storage provider - be it database, file system, external blob storage services. The CDN only serves as a proxy for this request. The typical workflow when you use a CDN is the following:
1) You upload media content - it gets stored in the configured storage provider (can also be Azure Blob Storage).
2) Sitefinity will generate its URL for the media content (according to the configured storage provider)- e.g. www.sitefinity.com/.../.... this URL will be only used to display the item while managing it in the backend.
3) When you need to use this item in content or media fields or image gallery Sitefinity will return the item's URL according to the configured CDN.
4) When this media content is requested with its CDN URL, the CDN will see if it has this item in its storage, if the item is not there it will retrieve it from your site and store it for a time period based on the Time to Live (TTL) settings of the CDN accont. Then the item will be served to the client by the CDN.
So lets say that I upload an image on Sitefinity.com. It will get a URL something like this
http://www.sitefinity.com/sitefinityImages/default-source/default-album/image.jpg.
But all references to it in HTML will be rendered using the CDN URL
http://d10fqi5lqqlsdr.cloudfront.net/Images/default-source/default-album/image.jpg.
The CDN approach is easier to set up - it is one attribute setting on your storage provider and you do not need to do anything else - next time Sitefinity has to render a page which has image gallery it will use the CDN location. Or if the item is being displayed in generic content - as long as the image selector has been used it will generate the new link. The caveat here is that if someone is not using dynamic links but directly referring media items by their URLs or resolving URLs using the Sitefinity API they will still call the image by the original URL.
Finally - simply configuring a CDN on a site like will give a significant immediate performance boost only because you will not serve media items from the same servers as the website.
Also since most CDN providers such as CloudFront expose edge servers throughout pretty much everywhere in most cases the media items will be served by servers that are closer to website visitors than the servers where you host the website.
So In case you need to use external Blob storage provider you need to implement it as for the Amazon S3 or Rackspace CloudFiles samples provided above.
I hope the information above was useful.
Regards,
Svetoslav Manchev
Telerik