Convert if statement to try_files with Nginx | بلاگ

Convert if statement to try_files with Nginx

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

I'm trying to use the try_files feature because the if statement is banned in Nginx.

When my value $test = 0 I want to proxy to an address and when $test = 1 I want to proxy to another address.

Here is what I tried, but I don't what to write in try_files ??

location /_matrix/ {
    default_type 'text/plain';

    try_files $test $uri/ @uri_true;
    try_files $test $uri/ @uri_false;
}

location @uri_true {
  proxy_pass    https://192.168.0.171:8448/;

  proxy_connect_timeout       300s;
  proxy_send_timeout          300s;
  proxy_read_timeout          300s;
}  

location @uri_false {
  proxy_pass    https://127.0.0.1:8448/;

  proxy_connect_timeout       300s;
  proxy_send_timeout          300s;
  proxy_read_timeout          300s;
} 
asked 16 secs ago
user9099802

...
نویسنده : استخدام کار بازدید : 6 تاريخ : سه شنبه 24 بهمن 1396 ساعت: 19:51