Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webp Image not generating when azure CDN enabled (Sitecore 10.2 + JSS + SXA) #126

Open
MariaPloscar opened this issue Jan 20, 2023 · 0 comments

Comments

@MariaPloscar
Copy link

MariaPloscar commented Jan 20, 2023

Version of Dianoga

We are on Sitecore 10.2 Docker Containers + JSS with NextJS + SXA and attempting to configure Dianoga 6.1.0

Environment description

Scaled environment.

What configs you have enabled

Dianoga.DisableForSites.config
Dianoga.Jpeg.config
Dianoga.Log.config
Dianoga.NextGenFormats.CDN.config
Dianoga.NextGenFormats.config
Dianoga.Png.config
Dianoga.Strategy.GetMediaStreamSync.config
Dianoga.Svg.config
z.01.Dianoga.NextGenFormats.WebP.config

Reproducible steps (1... 2... 3...) that cause the issue

It's working ok locally where we have CM container (XP0 topology).

But when deploying to Azure it's working ok on Preview/Experience Editor (CM container). But it's not working for CDs.

When accessing images with /-/media/ handler everything is ok. But for /-/jssmedia/ the images are not showed as image/webp content type.

We have replaced JSS media handler in web.config with custom one:

public class JSSWebPMediaHandler : MediaRequestHandler
{
protected override bool DoProcessRequest(HttpContext context, MediaRequest request, Sitecore.Resources.Media.Media media)
{
if (context?.Request.AcceptTypes != null && context.Request.AcceptTypes.Contains("image/webp"))
{
request.Options.CustomOptions["extension"] = "webp";
}
return base.DoProcessRequest(context, request, media);
}
}

We have replaced sitecore_media handler. The transform web.config.xdt applied:

image

The Azure Rule engine "customAccept" was setup.

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.

Is there anything we are missing?

Relevant logs

@kamsar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant