Search code examples
c#.netcorsimageresizer

Set CORS headers with ImageResizer


Is it possible to reply with the correct headers for CORS requests when using ImageResizer directly as a pipeline on IIS?

Using the RemoteReader plugin and sending an OPTIONS request also results in ImageResizer sending the resized image right away instead of waiting for the GET.

/remote.jpg.ashx?urlb64=...&hmac=P0E_Dl0Ill0&width=300

I know this is usually not a problem when loading images through an image-tag, but I have the scenario where a browser-based client needs to store binary data directly and uses javascript's XmlHttpRequest to do so.

Thanks!


Solution

  • Look at plugin development for ImageResizer, it shouldn't be hard to implement plugin that adds CORS headers.