hi there,
in my azure storage account i setup a photos container. with API calls i want to be able to upload files to this container. so i created an access policy for the container with racwdl permissions, and i generate a SAS token and URL from the shared access tokens tab.
in postman, i use the Blob SAS URL generated like this:
https://mystorageaccount.blob.core.windows.net/photos?sp=r&st=2024-07-19T12:45:40Z&se=2024-07-19T20:45:40Z&spr=https&sv=2022-11-02&sr=c&sig=signaturefromblobsasurl
in order to upload the logo.png file i want to upload, i modify the url to include the filename:
https://mystorageaccount.blob.core.windows.net/photos/logo.png?sp=r&st=2024-07-19T12:45:40Z&se=2024-07-19T20:45:40Z&spr=https&sv=2022-11-02&sr=c&sig=signaturefromblobsasurl
as headers in the put request i put:
x-ms-blob-type: BlockBlob
Content-Type: image/png
Content-Length: 21332
as Body i upload the file logo.png as a binary
when executing the request, this is returned:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">
</HEAD>
<BODY>
<h2>Bad Request - Invalid Hostname</h2>
<hr>
<p>HTTP Error 400. The request hostname is invalid.</p>
</BODY>
</HTML>
the message is that the hostname is invalid, however, i use the hostname as generated by the Blob SAS URL. using the same URL to access files already there in the container does not give an invalid hostname response.
how to resolve?