netnr / nginx-proxy_pass
2018-11-30 14:34

nginx代理授权验证访问的站点(伪造User-Agent、Cookie验证)

server {
    listen 66;
    location / {
            # 允许跨域
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Credentials' 'true';
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
            add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
            
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            # 代理地址
            proxy_pass http://updatebrowser.netnr.com/;

            proxy_cookie_domain domino.server nginx.server;
            
            proxy_set_header Host "updatebrowser.netnr.com";
            proxy_set_header DontTrackMeHere "";
            # 伪造 User-Agent
            proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI WindowsWechat QBCore/3.43.901.400 QQBrowser/9.0.2524.400";
            # 设置 Cookie
            proxy_set_header Cookie "PHPSESSID=p4e51ihjf57ovvc9lui2abkvi0; ot_openid=o1qKOwSziXkFeK-f_114Dy_2q-uE; first_vist=1;";
    }
}
ˆ