UnsupportedHttpVerb : The resource doesn't support specified Http Verb. RequestId:fa9c21f3-0001-005a-1484-d83478000000

Viewed 17229

I want to store a file to azure blob data through angular2 . so that i have created a storage with name "mysampleoxy"

and then created a container "videos" under blob. Now i want to upload the file from my local server to the Azure so that , i have created a sas key with url https://mysampleoxy.blob.core.windows.net/?sv=2016-05-31&ss=bfqt&srt=sco&sp=rwdlacup&se=2017-05-30T04:20:04Z&st=2017-05-29T11:20:04Z&spr=https&sig=4Ir2JxigytwHfbyhhY1K4dOWAgZvvZnEzbNKqB4cjSA%3D

and i have enabled the cors for blob with the below details

<CorsRule>
  <AllowedOrigins>*</AllowedOrigins>
  <AllowedMethods>PUT,GET</AllowedMethods>
  <AllowedHeaders>x-ms-meta-data*,x-ms-meta-target,x-ms-meta-source</AllowedHeaders>
  <ExposedHeaders>x-ms-meta-*</ExposedHeaders>
  <MaxAgeInSeconds>200</MaxAgeInSeconds>
</CorsRule>

But when i am trying to upload the file through my server the below error is showing in the console

<?xml version="1.0" encoding="utf-8"?>

<Error><Code>UnsupportedHttpVerb</Code>

<Message>The resource doesn't support specified Http Verb.
RequestId:fa9c21f3-0001-005a-1484-d83478000000
Time:2017-05-29T14:02:25.2296729Z</Message>

</Error>

and the Headers were :

Request URL: https://mysampleoxy.blob.core.windows.net/?sv=2016-05-31&ss=bfqt&srt=sco&sp=rwdlacup&comp=list&se=2017-05-30T01:21:04Z&st=2017-05-29T11:30:04Z&spr=https&sig=Ko5UzKrjRHhvQIJG2fpgGMgPiZiVxMhLTwNZbaiFNeA%3D

Request Method: PUT

Status Code: 405 The resource doesn't support specified Http Verb.

Remote Address: 52.172.16.136:443

Referrer Policy: no-referrer-when-downgrade i am not getting anything wrong with my cors configuration. any solutions regarding this could help me resolve this.

Thank you.

2 Answers

I was attempting to use POST, whereas PUT method was necessary.

Working code:

const url = `${baseURL}${containerName}/${file.name}?${Container_SAS}`;
      const response = await fetch(url,
                {
                    method: 'PUT',
                    headers: {
                        'x-ms-blob-type': 'BlockBlob',
                    },
                    body: file
                });
      console.log('response', response.statusText, response.status)
Related