Answer the question
In order to leave comments, you need to log in
What config is needed for nginx (transition from if to map)?
There is such a code. I want to move from if to map.
location /eset_upd {
if ($http_user_agent ~ .*BPC.[3].*) {
rewrite ^(.*) /eset_upd/v3/update.ver break;
}
if ($http_user_agent ~ .*BPC.[4].*) {
rewrite ^(.*) /eset_upd/v4/update.ver break;
}
if ($http_user_agent ~ .*BPC.[5].*) {
rewrite ^(.*) /eset_upd/v5/update.ver break;
}
if ($http_user_agent ~ .*BPC.[6].*) {
rewrite ^(.*) /eset_upd/v6/update.ver break;
}
if ($http_user_agent ~ .*BPC.[7].*) {
rewrite ^(.*) /eset_upd/v7/update.ver break;
}
map $http_user_agent $url {
.*BPC.[3].* /eset_upd/v3/update.ver;
.*BPC.[4].* /eset_upd/v4/update.ver;
.*BPC.[5].* /eset_upd/v5/update.ver;
.*BPC.[6].* /eset_upd/v6/update.ver;
.*BPC.[7].* /eset_upd/v7/update.ver;
}
location /eset_upd {
if ($url) {
rewrite ^(.*) $url break;
}
}
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