首页 > cf > CF加密

CF加密

2019年9月20日

/** http basic auth **/
// https://tool.oschina.net/encrypt?type=3
// gd:1024
const authorization = “Basic Z2Q6MTAyNA==”; //Basic base64加密gd:1024值
/**或者用这段:const authorization = “Basic ” + btoa(“账号:密码”); **/
/** http basic auth **/

var gd;

addEventListener(‘fetch’, event => {
console.log(event.request.headers.get(“Authorization”));
if (event.request.headers.get(“Authorization”) !== authorization) {
return event.respondWith(new Response(
null, {
status: 401,
statusText: “‘Authentication required.'”,
body: “Unauthorized”,
headers: {
“WWW-Authenticate”: ‘Basic realm=”User Visible Realm”‘
}
}
))
}

})

分类: cf 标签:
本文的评论功能被关闭了.