I’m trying to use a Wordpress plugin that converts existing image files into webp and then uses an nginx rule to try and get the webp version. If the webp version fails it reverts to default. Is it possible to do this with platform?
location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ {
add_header Vary Accept;
expires 365d;
try_files
/wp-content/uploads-webpc/$path.$ext$ext_webp
$uri =404;
}
I’ve tried several variations using locations in app.yaml but the closest I get is this in the nginx.conf on pkatform
location "/wp/wp-content/uploads/" {
alias /app/web/wp/wp-content/uploads/;
location "/wp/wp-content/uploads/" {
try_files $uri =404;
expires -1s;
}
location ~ "(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$" {
location ~ "(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$" {
set $_rewrite_path "/wp/wp-content/uploads-webpc/uploads/$path.$ext";
try_files $uri @rewrite;
expires -1s;
}
}
}
Thanks Dan