webp-express icon indicating copy to clipboard operation
webp-express copied to clipboard

On-demand WebP using WordOps

Open JPaulMora opened this issue 1 year ago • 0 comments

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?

JPaulMora avatar Jun 16 '23 22:06 JPaulMora