webp-express
webp-express copied to clipboard
On-demand WebP using WordOps
Hey, I'm using wordops (https://wordops.net) and I'm trying to setup on-demand webp generation with this
# try to load alternative image.png.webp before image.png
location /wp-content/uploads {
location ~ \.(png|jpe?g)$ {
add_header Vary "Accept-Encoding";
more_set_headers 'Access-Control-Allow-Origin : *';
more_set_headers "Cache-Control : public, no-transform";
access_log off;
log_not_found off;
expires max;
try_files $uri$avif_suffix $uri$webp_suffix $uri =404;
}
location ~* ^/?(.+)\.(webp)$ {
if (-f $request_filename) {
rewrite ^/?(.+)\.(webp)$ /wp-content/plugins/webp-express/wod/webp-realizer.php?xdestination-rel=xwp-content/uploads/$1.$2&wp-content=wp-content last;
# proxy_set_header X-DESTINATIONREL "wp-content/uploads/$1.$2";
# proxy_set_header X-WPCONTENT "wp-content";
}
}
location ~* \.(php|gz|log|zip|tar|rar|xz)$ {
#Prevent Direct Access Of PHP Files & Backups from Web Browsers
deny all;
}
}
currently it's not working, any ideas on how to implement this?