Nginx-image_filter_module与透明WebP传递和回退的结合

问题描述

即使已请求JPG或PNG资源,我仍使用Nginx Web服务器向Web客户端提供WebP图像。作为一种广泛接受的解决方案,我使用:

- map           // to set a resource suffix variable for compatible clients
- try_files     // to try to access the resource with the WebP suffix first and to fall back to the original ressource if no WebP resource is available

这工作得很好。现在,我认为将WebP方法与image_filter_module结合以实现以下目的会很好:

  • 用于动态调整请求资源大小的URL
  • 如果没有可用的WebP或客户端无法处理WebP资源,则image_filter使用WebP资源(如果可用)并回退到JPG / PNG资源的方式

有没有一种方法可以实现以下情形:

场景1

1. client requests PNG image
2. server kNows that client is capable of processing WebP resources
3. server does a proxy_pass of the WebP resource to the location the image_filter is used

场景2

1. client requests PNG image
2. server kNows that client is NOT capable of processing WebP resources or WebP is missing
3. server does a proxy_pass of the PNG resource to the location the image_filter is used

我希望你掌握了本质。任何想法,帮助或解决方案都非常感谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)