0
votes

We are having issues trying to server .js and .html5 files via an Azure app servicing running imageresizer which in turn, points to a blob store.

This works: http://devimageresizecdnbypass.reiwa.net//bannerads/10688-0/test-image.jpg

This doesn't: http://devimageresizecdnbypass.reiwa.net/bannerads/10688-0/js_ex3.js

Direct links to the blob store thereby bypassing imageresizer works.

I have a rewrite in the web.config to add imagefiles 'folder'.

<rule name="bannerads"> 
  <match url="^bannerads/([_0-9a-z-.]+)/([_ ,0-9a-z-.]+)" /> 
  <action type="Rewrite" url="/imagefiles/bannerads/{R:1}/{ToLower:{R:2}}" /> 
</rule>

and amongst other entries, the following -

<staticContent>
  <remove fileExtension=".pdf" />
  <mimeMap fileExtension=".pdf" mimeType="application/pdf" />
  <remove fileExtension=".js" />
  <mimeMap fileExtension=".js" mimeType="application/x-javascript" />      
</staticContent> 

Diagnosing it with Microsoft, they believe imageresizer isn't pre-pending the blob URL to the request passed back to Azure when non jpg files are requested.

We currently run imageresizer on an on-premises Windows 2008r2/iis box and these files are serving fine.

1

1 Answers

0
votes

ImageResizer isn't designed as a static file proxy. Although there are hacks to make it act as one, it's not going to be as performant, and lacks many features you might expect as a static file proxy.

If possible, we'd suggest linking directly to the blob store or a CDN endpoint for static files instead.

If you want to attempt having ImageResizer proxy these files, you'll need to configure the storage provider to permit that.

https://imageresizing.net/docs/v4/plugins/blobprovider

The relevant settings are: vpp="true", untrustedData="false", cacheUnmodifiedFiles="true", requireImageExtension="false".

You'll have additional concerns around updates - cacheMetadata's sliding behavior is good for images, but not good for immediate javascript updates. You'll also see increased disk cache growth.

AzureReader2, unlike other providers, also offers a redirectToBlobIfUnmodified setting. If true, and IF the internal, rewritten querystring lacks any processing directives, then a redirect is initiated. Inspecting the state of e.Querystring within a PostRewrite event handler can offer insight as to whether a configuration or component is causing the preconditions to fail.

Unfortunately, without the diagnostics page, most of this is conjecture. Version, configuration, and custom code matter quite a lot in this situation. Creating an empty project just to test static file proxy behavior may help you isolate the issue, but if possible, please update this question with more detail and your discoveries.