Discussions
CORS error when trying to use Azure Storage PUT request from frontend application
over 2 years ago by Mateo C
I'm trying to do a PUT to azure with axios on React:
const url =
'https://{MY-STORAGE-NAME}.blob.core.windows.net/cognito-test-file-container/mateo?sp=racwdl&sv=2018-11-09&sr=c&st=2022-07-04T19%3A52%3A00Z&se=2022-07-08T12%3A00%3A00Z&sip={MY-LOCAL-IP}&spr=https&sig={SECRET}%3D';
const response = await axios.put(url, imagefile?.files?.[0]);
But then I get the following CORS error, is there any way I can allow CORS for my local development or any recommended workarounds to PUT a JPG in azure storage?
Access to XMLHttpRequest at 'https://{MY-STORAGE-NAME}.blob.core.windows.net/cognito-test-file-container/mateo?sp=racwdl&sv=2018-11-09&sr=c&st=2022-07-04T19%3A52%3A00Z&se=2022-07-08T12%3A00%3A00Z&sip={MY-LOCAL-IP}&spr=https&sig={SECRET}%3D' from origin 'https://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.