Is there an alternative of using If to extract a value from a variable in Nginx config files?
I.e
if ($http_referer ~* (?<=url=)([\w-.]*)(?=/) ){
set $proxied $1;
rewrite (?<=/)(.+\.(css|jpg|png|gif|js)) http://$proxied/$1 redirect;
}
Thanks
Yes. http://nginx.org/r/map
map $http_referer $proxied {
default example.com;
"~*(?<=url=)(?<p>[\w-.]*)(?=/)" $p;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With