Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    I don’t think you use .htaccess files with nginx, but I could be wrong. At any rate, I don’t know how to do this with nginx, but if someone else has some experience in this area, feel free to chime in.

    The basic logic should look like this:
    1. Does the browser support webp (indicated in the HTTP_ACCEPT header)?
    2. Is this file a jpg/png (looking for an extension of jpeg/jpg/png, case insensitive)?
    3. Does a file exist with .webp appended to the end of the filename identical to #1
    4. rewrite the filename with .webp appended
    5. with mod_headers we append Accept to the Vary header
    6. we add an image/webp mimetype to the server’s mime-type list (this is something your host should do in a separate config).

    Plugin Author nosilver4u

    (@nosilver4u)

    I forgot someone once posted this: https://www.lazutkin.com/blog/2014/02/23/serve-files-with-nginx-conditionally/

    It worked for them, and the logic looks solid, and mostly matches what EWWW IO does for file-naming.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WEBP NGINX QUESTION’ is closed to new replies.