Windows Azure Platform Developer Center >
Microsoft Visual Studio 2010 Beta 2 Forums
>
Windows Azure
>
Azure CDN content-range GET parameter
Azure CDN content-range GET parameter
- Is it possible to specify which part of a blob that is desired to recieve by including GET parameter such as "http://az1071.vo.msecnd.net/container/blob?startbyte=12345&endbyte=54321"?
Update: The reason I need this is to use pseudo-streaming from Adobe Flash
/Martin
Answers
- Hi,
We cannot do that by query string. But it's possible by adding a Range HTTP Header:
For instance, in the following header, 1 is "startbyte" and 4 is "endbyte".
Range: bytes=1-4
Please refer to the following documentation for more details:
http://msdn.microsoft.com/en-us/library/dd179440.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework http://cfx.codeplex.com/! If you have any feedback, please tell us.- Marked As Answer bymacthestack Tuesday, November 10, 2009 10:56 AM
Just out of curiosity: it seems that CDN:s avoid quesrystrings at their cache servers, is there a reason for this?
Yes, there are reasons. CDNs cache static content; that is, content which is the same for all users who request the same URL. Query strings are a strong indicator that the content isn't actually static; that the content is different for each user. It makes caching more difficult; the "key" for the cache has to include the query strings. But since query strings have no consistent meaning to anyone other than the origin server that "knows" how to interpret the URL, a CDN can't know which query strings should be included in the cache "key", which should be ignored, etc.
When designing content for a CDN, you really want to avoid query strings. Use HTTP headers, which *do* have defined meaning which can be accomodated by a cache. If you have dynamic content, request it from a different hostname which isn't CNAMEd to your CDN provider. Pulling uncachable content through a CDN is bad for everyone - it hurts CDN cache efficiency, it's slower, the origin server doesn't even get to see the true original request (so log analysis for business intelligence purposes is tougher)...- Marked As Answer bymacthestack Tuesday, November 17, 2009 4:27 PM
All Replies
- Hi,
We cannot do that by query string. But it's possible by adding a Range HTTP Header:
For instance, in the following header, 1 is "startbyte" and 4 is "endbyte".
Range: bytes=1-4
Please refer to the following documentation for more details:
http://msdn.microsoft.com/en-us/library/dd179440.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework http://cfx.codeplex.com/! If you have any feedback, please tell us.- Marked As Answer bymacthestack Tuesday, November 10, 2009 10:56 AM
- Hi and thanks,
This is good but not sufficient for me as I can't control the request headers i.e. AS3 NetConnection. Are there any plans for supporting querystring parameters for this in the future?
Also, where can I find APIs/whitepapers about Azure CDN?
Many thanks!
/m - http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html#addHeader()
var my_conn = NetServices.createGatewayConnection( );
my_conn.addHeader('Range', false, "bytes=1-4");
BWC; - The addHeader method is not referring to http-headers but rather AMF-headers (if there hasn't been changes to the later flash versions). I think YouTube solves this problem by passing querystrings to their CDN.
A solution to this would clearly make Azure CDN a strong competitor amongst the existing CDN:s.
Just out of curiosity: it seems that CDN:s avoid quesrystrings at their cache servers, is there a reason for this?
/m Hi,
Thanks for your feature request. We've added it on our feature request list. We'll keep evaluating each feature request based upon priorities and customer impact to improve our products continuously.
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework http://cfx.codeplex.com/! If you have any feedback, please tell us.Just out of curiosity: it seems that CDN:s avoid quesrystrings at their cache servers, is there a reason for this?
Yes, there are reasons. CDNs cache static content; that is, content which is the same for all users who request the same URL. Query strings are a strong indicator that the content isn't actually static; that the content is different for each user. It makes caching more difficult; the "key" for the cache has to include the query strings. But since query strings have no consistent meaning to anyone other than the origin server that "knows" how to interpret the URL, a CDN can't know which query strings should be included in the cache "key", which should be ignored, etc.
When designing content for a CDN, you really want to avoid query strings. Use HTTP headers, which *do* have defined meaning which can be accomodated by a cache. If you have dynamic content, request it from a different hostname which isn't CNAMEd to your CDN provider. Pulling uncachable content through a CDN is bad for everyone - it hurts CDN cache efficiency, it's slower, the origin server doesn't even get to see the true original request (so log analysis for business intelligence purposes is tougher)...- Marked As Answer bymacthestack Tuesday, November 17, 2009 4:27 PM
- Thanks jdzions for the thourough answer!
I totally understand why dynamic content is unsuitable for caching but I argue that even though querystrings imply dynamic content in a RESTful environment there are many cases where querystrings can be used with static content, such as specifying ranges, authenticating or perhaps providing additional information for logging purposes when http-headers aren't available. Atleast "range" can have a consistent meaning to any interpreter as well as being meaningful when working with static content.
That being said I acknowledge that the core issue resides in Flash and that few of the leading CDN providers doesn't support what I'm suggesting. However I think this can be an easy way for Microsoft to grab some CDN market shares and more important to tie more developers to the Azure platform.
Have fun at PDC!
/m


