本文章编写中...
尚需时日...
下面给的只是一个原型,尚未验证...

NGINXserver{
    location / {
        default_type text/html;

        set $is_post 0;
        set $is_verify_passed 1;
        set $is_csrf_alarm 0;
        set $secret 'asgasdgdfg';
        set_md5 $_csrf_token $remote_addr$secret;
        set     $_csrf_token_post '';

        if ( $request_method = "POST" ) {
            set $is_post 1;
            set_form_input $_csrf_token_post '_csrf_token';
        }
        if ( $_csrf_token_post != $_csrf_token ) {
            set $is_verify_passed 0;
        }
        set $is_csrf_alarm $is_post$is_verify_passed;
        if ( $is_csrf_alarm = 10 ){
            echo '{"code":999,"error":true,"data":{"info":"_csrf_token error"}}';
            break;
        }
    }
}

ARGUS
1.6k 声望155 粉丝

便宜的SSL证书 www.ssl.com.ru