I have an nginx location redirect set up to redirect /my_route to a coming soon page, but allow /my_route?db=preview to pass through to the proxy server.
location /my_route {
if ($arg_db != "preview") {
rewrite ^ /coming-soon/ last;
}
<other location config for when db == preview>
}
I want to add an additional layer of complexity, to support multiple languages for the coming soon page.
Config that breaks nginx, but give you the idea:
location /my_route {
if ($arg_db != "preview") {
if ($arg_lang == "es") {
rewrite ^ /coming-soon/index_es.html last;
}
rewrite ^ /coming-soon/ last;
}
<other location config for when db == preview>
}
I know that if is evil, so I'm happy to move away from using if, if that's what is needed, but I don't know which direction to look. I just know nginx doesn't support && statements, or nested if statements.