标题:我用cf反代了loc,可是只有首页怎么办?
作者:三季稻
原帖:https://hostloc.com/thread-881587-1-1.html
摘要:https://billowing-block-5b0e.zzllxa.workers.dev
// 替换成你想镜像的站点 const upstream = 'hostloc.com' // 如果那个站点有专门的移动适配站点,否则保持和上面一致 const upstream_mobile = 'hostloc.com' // 你希望禁止哪些国家访问 const blocked_region = ['CN'] // 禁止自访问 const blocked_ip_address = ['0.0.0.0', '127.0.0.1'] // 替换成你想镜像的站点 const replace_dict = { '$upstream': '$custom_domain', '//hostloc.com': '' } //以下内容都不用动 addEventListener('fetch', event => { event.respondWith(fetchAndApply(event.request)); }) async function fetchAndApply(request) { const region = request.headers.get('cf-ipcountry').toUpperCase(); const ip_address = request.headers.get('cf-connecting-ip'); const user_agent = request.headers.get('user-agent'); let response = null; let url = new URL(request.url); let url_host = url.host; if (url.protocol == 'http:') { url.protocol = 'https:' response = Response.redirect(url.href); return response; } if (await device_status(user_agent)) { upstream_domain = upstream } else { upstream_domain = upstream_mobile } url.host = upstream_domain; if (blocked_region.includes(region)) { response = new Response('Access denied: WorkersProxy is not available in your region yet.', { status: 403 }); } else if(blocked_ip_address.includes(ip_address)){ response = new Response('Access denied: Your IP address is blocked by WorkersProxy.', { status: 403 }); } else{ let method = request.method; let request_headers = request.headers; let new_request_headers = new Headers(request_headers); new_request_headers.set('Host', upstream_domain); new_request_headers.set('Referer', url.href); let original_response = await fetch(url.href, { method: method, headers: new_request_headers }) let original_response_clone = original_response.clone(); let original_text = null; let response_headers = original_response.headers; let new_response_headers = new Headers(response_headers); let status = original_response.status; new_response_headers.set('access-control-allow-origin', '*'); new_response_headers.set('access-control-allow-credentials', true); new_response_headers.delete('content-security-policy'); new_response_headers.delete('content-security-policy-report-only'); new_response_headers.delete('clear-site-data'); const content_type = new_response_headers.get('content-type'); if (content_type.includes('text/html') && content_type.includes('UTF-8')) { original_text = await replace_response_text(original_response_clone, upstream_domain, url_host); } else { original_text = original_response_clone.body } response = new Response(original_text, { status, headers: new_response_headers }) } return response; } async function replace_response_text(response, upstream_domain, host_name) { let text = await response.text() var i, j; for (i in replace_dict) { j = replace_dict[i] if (i == '$upstream') { i = upstream_domain } else if (i == '$custom_domain') { i = host_name } if (j == '$upstream') { j = upstream_domain } else if (j == '$custom_domain') { j = host_name } let re = new RegExp(i, 'g') text = text.replace(re, j); } return text; } async function device_status (user_agent_info) { var agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (var v = 0; v 0) { flag = false; break; } } return flag; }复制代码
作者:三季稻
原帖:https://hostloc.com/thread-881587-1-1.html
摘要:https://billowing-block-5b0e.zzllxa.workers.dev
// 替换成你想镜像的站点 const upstream = 'hostloc.com' // 如果那个站点有专门的移动适配站点,否则保持和上面一致 const upstream_mobile = 'hostloc.com' // 你希望禁止哪些国家访问 const blocked_region = ['CN'] // 禁止自访问 const blocked_ip_address = ['0.0.0.0', '127.0.0.1'] // 替换成你想镜像的站点 const replace_dict = { '$upstream': '$custom_domain', '//hostloc.com': '' } //以下内容都不用动 addEventListener('fetch', event => { event.respondWith(fetchAndApply(event.request)); }) async function fetchAndApply(request) { const region = request.headers.get('cf-ipcountry').toUpperCase(); const ip_address = request.headers.get('cf-connecting-ip'); const user_agent = request.headers.get('user-agent'); let response = null; let url = new URL(request.url); let url_host = url.host; if (url.protocol == 'http:') { url.protocol = 'https:' response = Response.redirect(url.href); return response; } if (await device_status(user_agent)) { upstream_domain = upstream } else { upstream_domain = upstream_mobile } url.host = upstream_domain; if (blocked_region.includes(region)) { response = new Response('Access denied: WorkersProxy is not available in your region yet.', { status: 403 }); } else if(blocked_ip_address.includes(ip_address)){ response = new Response('Access denied: Your IP address is blocked by WorkersProxy.', { status: 403 }); } else{ let method = request.method; let request_headers = request.headers; let new_request_headers = new Headers(request_headers); new_request_headers.set('Host', upstream_domain); new_request_headers.set('Referer', url.href); let original_response = await fetch(url.href, { method: method, headers: new_request_headers }) let original_response_clone = original_response.clone(); let original_text = null; let response_headers = original_response.headers; let new_response_headers = new Headers(response_headers); let status = original_response.status; new_response_headers.set('access-control-allow-origin', '*'); new_response_headers.set('access-control-allow-credentials', true); new_response_headers.delete('content-security-policy'); new_response_headers.delete('content-security-policy-report-only'); new_response_headers.delete('clear-site-data'); const content_type = new_response_headers.get('content-type'); if (content_type.includes('text/html') && content_type.includes('UTF-8')) { original_text = await replace_response_text(original_response_clone, upstream_domain, url_host); } else { original_text = original_response_clone.body } response = new Response(original_text, { status, headers: new_response_headers }) } return response; } async function replace_response_text(response, upstream_domain, host_name) { let text = await response.text() var i, j; for (i in replace_dict) { j = replace_dict[i] if (i == '$upstream') { i = upstream_domain } else if (i == '$custom_domain') { i = host_name } if (j == '$upstream') { j = upstream_domain } else if (j == '$custom_domain') { j = host_name } let re = new RegExp(i, 'g') text = text.replace(re, j); } return text; } async function device_status (user_agent_info) { var agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (var v = 0; v 0) { flag = false; break; } } return flag; }复制代码
标题:憋了很久了,一直在自己努力,无果,还是来伸手了
作者:g6162227
原帖:https://hostloc.com/thread-881588-1-1.html
摘要:请问论坛里的签到在哪?我想快速成元老。。。
作者:g6162227
原帖:https://hostloc.com/thread-881588-1-1.html
摘要:请问论坛里的签到在哪?我想快速成元老。。。
标题:大佬们 买个小鸡 建立tor节点 通过小鸡 做个多重代理好不好
作者:youxiajieke
原帖:https://hostloc.com/thread-881590-1-1.html
摘要:大佬们 买个小鸡 建立tor节点 通过小鸡 做个多重代理好不好
代理不是很懂 要是自己多个小鸡 都加入tor节点 通过这几个tor节点转过来 转过去 上网会不会安全很多呀
作者:youxiajieke
原帖:https://hostloc.com/thread-881590-1-1.html
摘要:大佬们 买个小鸡 建立tor节点 通过小鸡 做个多重代理好不好
代理不是很懂 要是自己多个小鸡 都加入tor节点 通过这几个tor节点转过来 转过去 上网会不会安全很多呀
标题:母鸡我装Proxmox-VE开几台小鸡。我可以母鸡装宝塔做站吗?
作者:BigSite
原帖:https://hostloc.com/thread-881593-1-1.html
摘要:开的小鸡都有独立IP都是win,自用的小鸡。
我可以在母鸡上装宝塔做网站吗?我网上看到有人说母鸡装了宝塔小鸡会不能联网?
有没有大佬懂的?
作者:BigSite
原帖:https://hostloc.com/thread-881593-1-1.html
摘要:开的小鸡都有独立IP都是win,自用的小鸡。
我可以在母鸡上装宝塔做网站吗?我网上看到有人说母鸡装了宝塔小鸡会不能联网?
有没有大佬懂的?
标题:阿汗酋 和 阿联酋 机房,据说都可抗投诉,哪位MJJ有货?
作者:adminn
原帖:https://hostloc.com/thread-881597-1-1.html
摘要:谁有,可能订购的人多~~
作者:adminn
原帖:https://hostloc.com/thread-881597-1-1.html
摘要:谁有,可能订购的人多~~
标题:甲骨文paypal验证失败,钱怎么拿回来l
作者:byhmsrsh4
原帖:https://hostloc.com/thread-881599-1-1.html
摘要:前几天跟风上车,试了大概七八次,银行卡有几十块不可用,怎么样才能拿回来?
作者:byhmsrsh4
原帖:https://hostloc.com/thread-881599-1-1.html
摘要:前几天跟风上车,试了大概七八次,银行卡有几十块不可用,怎么样才能拿回来?
标题:江苏这边联通宽带怎么样
作者:红白菜
原帖:https://hostloc.com/thread-881600-1-1.html
摘要:打游戏还行吗 刚去营业厅看了下 才69一个月 500m、30g、600分钟
作者:红白菜
原帖:https://hostloc.com/thread-881600-1-1.html
摘要:打游戏还行吗 刚去营业厅看了下 才69一个月 500m、30g、600分钟
标题:所以说FB是个什么沙雕东西啊,动不动账号就没了
作者:PA-fan
原帖:https://hostloc.com/thread-881601-1-1.html
摘要:用HK IP,HK电话,HK地址注册的,存活了一个月,中途我还上去关注了一些频道之类的东西。说封就封了。
作者:PA-fan
原帖:https://hostloc.com/thread-881601-1-1.html
摘要:用HK IP,HK电话,HK地址注册的,存活了一个月,中途我还上去关注了一些频道之类的东西。说封就封了。
标题:腾讯云出bug了 程序员这不祭天??
作者:net777
原帖:https://hostloc.com/thread-881602-1-1.html
摘要:距离下次领取还有0天 是什么鬼???
没听说有个下次领取还有0天的
作者:net777
原帖:https://hostloc.com/thread-881602-1-1.html
摘要:距离下次领取还有0天 是什么鬼???
没听说有个下次领取还有0天的
标题:我是不是买到灵车了
作者:艾米休艾米休
原帖:https://hostloc.com/thread-881603-1-1.html
摘要:https://secure.2cy.net/
对香港60G口感兴趣,但三天了还没开通,也没办法提交工单...
作者:艾米休艾米休
原帖:https://hostloc.com/thread-881603-1-1.html
摘要:https://secure.2cy.net/
对香港60G口感兴趣,但三天了还没开通,也没办法提交工单...
标题:电视盒子买哪个好? 老人用
作者:三季稻
原帖:https://hostloc.com/thread-881604-1-1.html
摘要:电视好像没hdmi, 所以只能用三色线,想给换个电视还不让换
那么问题来了,买哪个电视盒子好? N1直接排除了吧?
作者:三季稻
原帖:https://hostloc.com/thread-881604-1-1.html
摘要:电视好像没hdmi, 所以只能用三色线,想给换个电视还不让换
那么问题来了,买哪个电视盒子好? N1直接排除了吧?
标题:Windows Server 2022正式公布
作者:二氧化碳
原帖:https://hostloc.com/thread-881606-1-1.html
摘要:Build号是20348.1,而之前的Windows Server 2019是17763.1,看起来像是在windows 11基础上做出来的,但是win11明明已经还没有展示公布。另外一个,windows 11 ltsc可能要来了,毕竟之前ltsb/ltsc就是server版本阉割的。可以去这里下载https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2022
作者:二氧化碳
原帖:https://hostloc.com/thread-881606-1-1.html
摘要:Build号是20348.1,而之前的Windows Server 2019是17763.1,看起来像是在windows 11基础上做出来的,但是win11明明已经还没有展示公布。另外一个,windows 11 ltsc可能要来了,毕竟之前ltsb/ltsc就是server版本阉割的。可以去这里下载https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2022
标题:有大佬知道ovh的ip 有版权什么问题吗
作者:eraino
原帖:https://hostloc.com/thread-881609-1-1.html
摘要:有大佬知道ovh的ip 有版权什么问题吗
比如买点ip 出租多ip 小鸡
会出现问题吗
如何避免
作者:eraino
原帖:https://hostloc.com/thread-881609-1-1.html
摘要:有大佬知道ovh的ip 有版权什么问题吗
比如买点ip 出租多ip 小鸡
会出现问题吗
如何避免
标题:请教一下,摄像头不突的且是后置指纹的小米手机
作者:t9913085
原帖:https://hostloc.com/thread-881608-1-1.html
摘要:除了max2还有那款啊 MAX2太大了
作者:t9913085
原帖:https://hostloc.com/thread-881608-1-1.html
摘要:除了max2还有那款啊 MAX2太大了