CDN - Versioned URLs & expirations RRS feed

  • Question

  • Hi there,

    I have just started to implement a solution based on the Azure CDN capabillities for web applications and have some questions how to properly invalidate "old" or "retired" URLs. The application we are building are in short serving tile requests from a google map page / app and returns json data via the CDN.
    All tile URLs are "versioned" by having a token / date in the url, e.g.:

    Example: "/spatial/tiles/2011.10.31/10/700/300"

    Format:   "/spatial/tiles/{date}/{zoomLevel}/{x}/{y}"

    Lets now say that  our web client would for some reason send an old URL (with yesterdays date in it) or if someone would request a future URL (with tomorows date) what should i reply to the to the CDN (and the web client) to avoid that the tile is cached on the CDN or even worse that i would be billed for none existing / invalid / illegal URLs?



    Monday, October 31, 2011 7:52 PM


  • Hi,

    I assume you’re using CDN for hosted services instead of blob. Currently the only way to control a hosted service’s CDN expiration is to use the clientCache node in web.config. You can only specify a global expiration time. Refer to http://msdn.microsoft.com/en-us/library/gg680299.aspx for more information. I don’t think there’s a good solution to handle your requirement. If the content does not exist in CDN, CDN will always request your actual service, and will always cache the content. One solution in my mind is not to serve old/future contents under the cdn URL. CDN requires your contents to be served under the URL like http://name.cloudapp.net/cdn/something. So you can serve old/future contents from another URL like http://name.cloudapp.net/another/something. Your clients must know both the CDN URL and your hosted service’s URL, and if they cannot find the content from CDN, they must request your hosted service directly. You’re still required to pay for those invalid requests to the CDN. But the cost is very low. The most significant cost of CDN is data transferred. You’re required to pay 0.15 to 0.20 for each GB of data transferred (depending on which data center it is). Invalid requests do not cause large data transfer. If you expect frequent requests to old/future contents, you can cache them in CDN anyway.


    Best Regards,

    Ming Xu.

    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Tuesday, November 1, 2011 10:09 AM