YetaWF.Core.WebpHttpHandler Documentation



The YetaWF.Core.WebpHttpHandler assembly/package processes HTTP requests for *.png and *.jpg/jpeg image files and serves *.webp files instead, a next-gen format. This shrinks the size of images considerably and will decrease bandwidth requirements. It also improves a website's score when testing sites with PageSpeed Insights.

YetaWF websites continue to use *.png and *.jpg files. The build pipeline creates WebP files (with the extension *.webp-gen, identifying generated WebP images). When an HTTP request is made for a *.png or *.jpg file AND the client-request supports the "image/webp" content type, YetaWF serves the corresponding *.webp-gen file instead. If the client does not support the "image/webp" content type, the regular *.png or *.jpg image is used instead. This processing is automatic for all files in the .\Website\Addons and .\Website\AddonsCustom folders.

WebP files are cached by the HTTP Webp handler and the HTTP Webp handler adds ETag and Last-Modified headers for caching support and honors the If-None-Match header of incoming requests. The HTTP handler honors the settings Application.P.StaticFiles.Duration (Appsettings.json) which determines caching duration.

The HTTP Webp handler is implemented by the YetaWF.Core.HttpHandler.WebpHttpHandler class.

See Also YetaWF.Core