SHARE
TWEET

Untitled

a guest Aug 18th, 2019 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. location ~* ^.+\.(jpeg|jpg|JPG|png)$ {
  2.  
  3.     if ($http_accept ~* "webp")    { set $webp_accept "A"; }
  4.     if (-f $request_filename.webp) { set $webp_local  "true"; }
  5.  
  6.     # если WebP есть, то передать Vary
  7.     if ($webp_local = "true") {
  8.     expires max;
  9.         add_header Vary Accept;
  10.     set $webp_accept  "${webp_accept}B";
  11.     }
  12.  
  13.     # если клиент поддерживает WebP, то передать файл
  14.     if ($webp_accept = "AB") {
  15.     rewrite (.*) $1.webp break;
  16.         expires max;
  17.     }
  18.     expires max;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top