Artem Tomyuk
November 16, 2015 10:36AM
Hi all.

The mission is to conditionally serve *.webp.

First of all i have map in my http section.

map $http_accept $webp_suffix {

default "";

"~*webp" ".webp";
}

The purpose of this map is to check if the user agent supports the webp.

The second thing we need somehow combine it in try_file.....
There is an example from config.

location ~
/resize/([-_0-9a-z]+)/([0-9a-z]+)/([0-9a-z]+)/([-_0-9a-z]+)\.jpg$ {

add_header Vary Accept;

And there i want to do something like:

try_files /resize/$1/$2/$3/$4$webp_suffix /resize/$1/$2/$3/$4.jpg =404

But it is not working.

The only thing is working is try_files $uri$webp_suffix $uri =404. But this
combination is checking for image_name.jpg.webp. but i need to look for

image_name.webp.

The question is how to concat 2 variables (one from regexp, the other one
from map definition) in try section.

Thanks.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Is it possible to use 2 variables (one from regexp, the other one from map definition)?

Artem Tomyuk November 16, 2015 10:36AM

Re: Is it possible to use 2 variables (one from regexp, the other one from map definition)?

Maxim Dounin November 16, 2015 10:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 150
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready