I have an ASP.NET WEB API and an angular project. I was willing to use the Azure blob storage to retrieve image files and display them to the users. Is it good practice to retrieve the image URL from the API, send it to the client-side and then use that URL on the client-side to display the image? Url example: https://someurl.blob.core.windows.net/blobcontainer/someimage
I am not sure if I should hide the Url from the users.
-
I suggest that first of all you setup a Custom Domain on your storage account.Daniel Björk– Daniel Björk2020-08-24 08:02:59 +00:00Commented Aug 24, 2020 at 8:02
-
@DanielBjörk Thank you for your suggestion. Can you please tell me more about why I should use a custom domain for the storage account?Volvo– Volvo2020-08-24 08:21:30 +00:00Commented Aug 24, 2020 at 8:21
-
So that your URL hides that you are using a Azure Storage Account. Instead you will get img.yourdomain.com/xxx/myimage.jpgDaniel Björk– Daniel Björk2020-08-24 08:23:54 +00:00Commented Aug 24, 2020 at 8:23
1 Answer
if this is a client side app and it will be used a lot another good practice would be to use Azure CDN which is very easy to use with Azure BLOB Storage. Use relative URLs, one way would be to put the exact path in your app settings for example web.config file but the imagename.jpg in your app and lastly secure the access to your storage from your client side via SAS which is one of the most common ways of securing it.
https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview
best practices for security for Azure BLOB Storage https://learn.microsoft.com/en-us/azure/storage/blobs/security-recommendations