locked
CDN Accessed by Multiple Origins getting Cached by Browser Resulting in CORS Issue RRS feed

  • Question

  • Looking for best solution to a browser caching problem for CDN assets. We have multiple origins accessing the same CDN asset. But when switching between origins and requesting the asset we are seeing it pulled from browser cache and then CORS is failing. We setup the rules correctly for Verizon Premium CDN as we are able to access from both origins and doing hard reload and clearing of cache. But when bouncing between origins we are seeing CORS error as request is cached and the origins do not match.
    Monday, January 6, 2020 8:15 PM

All replies

  • Greetings,

    When the browser or another user agent caches the response from a CORS request, the origin domain is cached as the allowed origin. When a second domain issues the same request for a storage resource while the cache is active, the user agent retrieves the cached origin domain. The second domain does not match the cached domain, so the request fails when it would otherwise succeed. In certain cases, Azure Storage sets the Vary header to Origin to instruct the user agent to send the subsequent CORS request to the service when the requesting domain differs from the cached origin.

    In the case where a GET/HEAD request matches a CORS rule that allows all origins, the response indicates that all origins are allowed, and the user agent cache will allow subsequent requests from any origin domain while the cache is active.

    Note that for requests using methods other than GET/HEAD, the storage services will not set the Vary header, since responses to these methods are not cached by user agents.
    For more information on understanding how the Vary header is set then please go through this doc.

    If you think your question has been answered, click "Mark as Answer" if just helped click "Vote as helpful". This can be beneficial to other community members reading this forum thread.


    Best regards
    Subhash

    Monday, January 13, 2020 11:45 AM
  • Hello,

     

    If you think your question has been answered, please click "Mark as Answer" if just helped click "Vote as helpful". This can be beneficial to other community members reading this forum thread.

     

    Best regards

    Subhash

    Tuesday, January 28, 2020 7:22 AM