Answer the question
In order to leave comments, you need to log in
Which nginx location rules to apply to redirect a file with a given type to a jpg file?
The site uses nginx rules to display webp files:
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|woff2|webp)$
{
if ( $http_accept ~* webp ) {
set $ webp "A";
}
if ( $request_filename ~ (.+)\.(png|jpe?g)$ ) {
set $file_without_ext $1;
}
if ( -f $file_without_ext.webp ) {
set $webp "${webp}E";
}
if ( $webp = AE ) {
add_header Vary Accept;
rewrite ^(.+)\.(png|jpe?g)$ $1.webp break;
}
But, images from the site are also used in the mobile application. Not all mobile devices support webp. I think to solve the problem by returning only the original jpg to the mobile application. Can you tell me the ngnix rules for redirecting a file with the jpg_m extension to a jpg file, bypassing the webp image connection?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question