Is it possible to use 2 variables (one from regexp, the other one from map definition)?
Artem Tomyuk
admin at leboutique.com
Mon Nov 16 15:34:10 UTC 2015
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151116/420381f4/attachment.html>
More information about the nginx
mailing list