nginx禁止跨域访问

  • Post author:
  • Post category:其他



nginx禁止跨域访问

            set $flag "0";
            if ($http_origin !~* "^https://xy.ctmmedia.com.cn") {
                set $flag "1";
            }
            if ($request_method = "POST") {
                set $flag "${flag}2";
            }
            if ($request_uri ~* "school/sysDict/redisRefresh") {
                set $flag "1";
            }
            if ($flag = "12") {
                return 404;
            }
	    add_header Access-Control-Allow-Origin 'https://xy.ctmmedia.com.cn';
        location /school/ {
            set $flag "0";
            if ($http_origin !~* "^https://xy.ctmmedia.com.cn") {
                set $flag "1";
            }
            if ($request_method = "POST") {
                set $flag "${flag}2";
            }
            if ($request_uri ~* "school/sysD



版权声明:本文为xhx94原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。