How to deal with Safari display issues on Mac and iOS when using Docker’s Nginx for WebP support

When handling WebP format images in a Nginx environment using Docker, a problem has been reported that images are not displayed in Safari on Mac and iOS. This phenomenon occurs because some browsers do not yet fully support the WebP format.

One specific workaround is to comment out the WebP configuration section from the Nginx settings. This will avoid display problems with certain browsers.

# location ~* ^. . (png|jpe?g)$ { 
# add_header Vary Accept; 
# try_files $uri$webp_suffix $uri =404; 
# }

The above code shows the configuration for handling images originally in WebP format. Commenting out (#) disables this setting, and WebP-format images are treated by Nginx as normal static files.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top