Azure Blob storage CORS Policy does not applying

Hemant Ashok 15 Reputation points
2025-02-21T08:44:43.8566667+00:00

Hello,

I have set up Azure Blob Storage with a Private access level, and I am able to access the blob files by generating access tokens from my application.

I have also configured CORS, but it's not working as expected.

My goal is to ensure that only my application can access the blob content using the access token and CORS policy.

Could you please assist me with this issue?

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,199 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Alex Burlachenko 10,255 Reputation points
    2025-02-21T11:02:08.7133333+00:00

    Hey Hemant,

    CORS can be a pain, but let’s keep it simple. If your app is server-side (using tokens), CORS doesn’t apply it’s only for browser requests. If it’s frontend, check your CORS rules in Azure step by step

    first is set allowed origins (your app’s domain)? next allow methods (GET, POST, etc.). and wait a few mins Azure caches CORS settings.

    If it’s still not working, check the browser console for errors.

    You’ve got this! Let me know if you need more help.

    rgds,

    Alex,


  2. Livermore, Graham 0 Reputation points
    2025-06-21T05:33:00.14+00:00

    I resolved this using sas tokens and cors rules with correct access when creating the token ie rl and r (read, read-list). Under CORS rules, i added my origin. The exact one which was throwing the error. I set GET, HEAD and OPTIONS. Then under Allowed headers: x-ms-blob-type and content-type. Exposed headers: x-ms-blob-type. max-age: 0. I also found that if your container has extra paths, they are not really paths. as in: baseUrl/container/something/something/blob.json so you need to fetch the data using prefixes and not slashes. as in baseUrl/container&prefix=something/something/sas-token. I also noticed it took about 15 minutes to apply. So being patient here after each change pays off.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.