Nginx笔记

代码 · 2022-01-21 · 173 人浏览

nginx匹配get参数和判断ua

location ~* ^/(w|v)_.*$ {
        set $flag 0;
        if ($arg_social_platform = "wechat_circle") {
            set $flag "${flag}1";
        }
        if ($http_user_agent ~* "MicroMessenger") {
            set $flag "${flag}2";
        }
        if ($flag = "012") {
            proxy_pass  [http://vue](http://vue)_qae;
        }
        proxy_pass http://10.110.117.55:80;
    }

原文->

Theme Jasmine by Kent Liao