Search code examples
azureimageresizer

Receive 400 Bad Request from Image Resizer request in Azure


ImageResizer is running as an Azure virtual application (after ImageResizer hotfix). This runs fine in Azure emulation but is having problems in Azure cloud. Image Resizer is working fine if no query string arguments are specified and the url redirects to blob storage, but if a query string argument is specified then I receive a 400 "Bad Request" error.

Below is a screenshot of my browser:

enter image description here

My Azure instance is running Windows Server 2012. I have also disabled the DiskCache plugin to reduce the problem.


Solution

  • I got the same problem as You. I used fiddler to see if I could figure out what went wrong and I think I fixed it. It's a problem with AzureReader2 and how it concatenates URL'S.

    A specific example from fiddler is this URL: http://xxx.blob.core.windows.net//card-images/14_main_image.png

    As you can see it got two slashes in a row which gives you the 400 "bad request".

    I downloaded the sourcecode for AzureReader2 and replaced all occurrences of "CloudBlobClient.BaseUri.OriginalString" with "CloudBlobClient.BaseUri.OriginalString.TrimEnd('/', '\')"

    I don't know if it's the best fix, but at least it's working until a better fix comes. If you are interested, I can send you the compiled dll.

    Best Regards Martin