T
T
TechNOIR2020-06-16 11:58:09
Nginx
TechNOIR, 2020-06-16 11:58:09

nginx. How to change alias depending on url arguments?

Good afternoon.

There is such a location:

location = /conf.js {
    alias /config/conf.js;
}


I want to make sure that if it contains the argument arg1 is valid (for example https://site.com?arg1=4982948394) then /config/conf2.js would be behind conf.js, in all other cases

/config/conf.js do?

thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-06-16
@TechNOIR

map $arg_arg1 $conf {
    default      "conf.js";
    "4982948394" "conf2.js";
}
server {
    location = /conf.js {
        alias /config/$conf;
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question