With Dianoga.WebP.config
enabled, I replaced JSS
media handler in web.config
:
with custom one:
using MediaRequestHandler = Sitecore.JavaScriptServices.Media.MediaRequestHandler;
public class JSSWebPMediaHandler : MediaRequestHandler
{
protected override bool DoProcessRequest(HttpContext context, MediaRequest request, Media media)
{
if (context?.Request.AcceptTypes != null && context.Request.AcceptTypes.Contains("image/webp"))
{
request.Options.CustomOptions["extension"] = "webp";
}
return base.DoProcessRequest(context, request, media);
}
},
Environment description Scaled environment
What configs you have enabled
Dianoga.DisableForSites.config,
Dianoga.Jpeg.config,
Dianoga.Png.config,
Dianoga.WebP.CDN.config ,
Dianoga.WebP.config,
Dianoga.Svg.configDianoga.Svg.config,
Dianoga.Strategy.GetMediaStreamSync.config
What you expected to see, versus what you actually saw expected result: Images should convert to webp format Actual result: Images are coming in the same png and jpg format
In a standalone environment without CDN the images are converting to webp images but in a scaled environment with Azure CDN images are not converting