如何解决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 举报,一经查实,本站将立刻删除。