Dianoga
Dianoga copied to clipboard
Webp Image not generating when azure CDN enabled (Sitecore 9.2 + JSS)
Sitecore 9.2 (JSS) and Dianoga 5.3.0
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,
What you expected to see, versus what you actually saw
expected result : Images should convert to webp format Actual result : Images are coming in same png and jpg format
In standalone environment without CDN the images are converting to webp images but in scaled environment with Azure CDN images are not converting
Relevant logs
There are relevant logs
In Azure CDN can you make sure that cache by query string is enabled?
@markgibbons25 , Yes Its enabled.
I'm not sure then, I haven't tested it with JSS / Azure CDN / Azure Front Door, only with CloudFlare (no JSS). I'd say its more likely an issue with JSS not having the right query string.
For Azure CDN support you'll need to upgrade to 6.1.0 and review the readme config for this.