6481

AzureReader2 not working with querystring

Question:

I have images in private blockblobs in Azure.

I am using Azure Reader 2 and can access the image like this <a href="http://localhost:55328/azure/00001/IMG_0001.JPG" rel="nofollow">http://localhost:55328/azure/00001/IMG_0001.JPG</a> - it works fine and redirects to the blob with a Shared Access Signature.

However, if I try to resize the image, e.g. IMG_0001.JPG?width=100&height=100, I just get a 404.

Stepping through the code, I notice this line

if (e.VirtualPath.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && e.QueryString.Count == 0) { .... }

So, if there's a QueryString, no processing happens.

Debug output here: <a href="https://gist.github.com/anonymous/28fd112eec194181baae" rel="nofollow">https://gist.github.com/anonymous/28fd112eec194181baae</a>

Thanks in advance

Answer1:

Your debugging misled you. It's true that redirection only happens when there is no querystring. When there <em>are</em> parameters, the blob needs to be modified, which means we <em>must</em> proxy it. A 302 redirect in that scenario is impossible.

AzureReader registers a IVirtualImageProvider, which ImageResizer automatically uses when handling all the proxying, processing, and caching.

<strong>The default behavior is to download, modify, and re-serve the data. The 302 redirect is just an optimization for throughput on unmodified files.</strong>

Notes:

sharedAccessExpiryTime is ignored, there is no setting by that name.

If you are going to reference code, it's best to <a href="https://github.com/imazen/resizer/blob/d66072a13d61421d357a66d0d349b84be9b1c804/Plugins/AzureReader2/AzureReader.cs#L106" rel="nofollow">link to the line in the file on github</a>, otherwise we can't easily find the context. Press y on any github page to get a permalink, then click a line number (or range).

Recommend

  • AzureReader2 not working with querystring
  • Execute multiple controller actions in one call with MVC.Net 5
  • AudioGraph throws XAUDIO2_E_INVALID_CALL on second frame input node
  • Get the VirtualPath From the Area, Controller and Action
  • Given a Uri value how can one check whether it refers the local machine?
  • Transferring DropDownList values from one page to the next
  • Spark - missing 1 required position argument (lambda function)
  • How to display a dictionary which contains a list in a listBox C#
  • “No overload takes 2 arguments” but IntelliSense shows overload with 2 arguments
  • Alternative to ReadLine?
  • How to get next 2 nodes in HTML + HTMLAgilitypack
  • Query about Entity Framework caching
  • I fixed the safari/asp:menu issue using addedcontrol method. Why does this work?
  • Index was outside Error at Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.VirtualPathUtili
  • downloading .zip file with maximum file size limit
  • Unity InputField OnValueChanged event shows one less character for InputField.text
  • Compare strings with non-English characters?
  • MVC JsonNetResult - “dataloss” when serializing List
  • Any Framework functions helping to find the longest common starting substring of multiple strings?
  • Lazy parse a stateful, multiline per record data stream in Python?
  • ASP.NET QueryString without equals sign
  • MongoDB ObjectIds exposure
  • Reference generic url parameter in AuthorizeAttribute
  • How to add new collection criteria in Plone 5?
  • Permission screen appears every time
  • jaxb xsd prefix package names
  • Set cookie from Web Api 2 IAuthenticationFilter AuthenticateAsync method
  • Process.StartTime Access Denied
  • Get Users in Group from Azure AD via Microsoft Graph
  • Getting JavaScript runtime error: irrationalPath, what does it mean?
  • How does extglob work with shell parameter expansion?
  • proxy request in node.js / express
  • Better file search algorithm than creating a list of files
  • Search files(key) in s3 bucket takes longer time
  • What does Main.1 output file do in XCode?
  • How to populate html table with info from list in django
  • ApplePay PKPaymentAuthorizationViewController always shows processing
  • Validate child input components on submit with Vee-Validate and vue js 2
  • Intel-64 and ia32 atomic operations acquire-release semantics and GCC 5+