又来一个版本。直接在CF的worker里添加代码。添加路由的时候，记得网址后面有/*又弄了一个演示：https://loc.513513.xyz2023-5-25 16:491.修复头像2.修复交易帖显示缺失直接上代码：/** * write by 西柚论坛 https://www.xiubbs.com */ addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); }); // 准备反代的目的域名 let target_url = "https://hostloc.com"; // 要替换内容的正则表达式 let target_url_reg = /(?<=\/\/).*?hostloc\.com/g; async function handleRequest(request) { let url = new URL(request.url); url.hostname = new URL(target_url).hostname; // 复制请求对象并更新它的属性 let headers = new Headers(request.headers); headers.set("Referer", target_url); headers.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"); //处理头像的302跳转，处理编辑帖子之后的报错 let redirect = "manual"; if(url.href.indexOf("/uc_server/") > -1){ redirect = "follow"; } const param = { method: request.method, headers: headers, body: request.body, redirect: redirect } let response = await fetch(url, param); // 检查响应头中的内容类型 const contentType = response.headers.get('content-type'); if (contentType && contentType.includes('text')) { // 如果是文本类型，替换响应主体中的URL let responseBody = await response.text(); responseBody = await handleResBody(request,responseBody); // 复制响应对象并更新它的属性 let headers = await handleResHeader(response); return new Response(responseBody, { status: response.status, statusText: response.statusText, headers: headers }); } else { // 如果不是文本类型，直接返回响应对象 return response; } } async function handleResBody(request, responseBody){ responseBody = responseBody.replace(target_url_reg, new URL(request.url).hostname); responseBody = responseBody.replace(" ", ' \n '); responseBody = responseBody.replace(" ", ' \n '); responseBody = responseBody.replace(" ", ' \n '); return responseBody; } async function handleResHeader(resp){ let headers = new Headers(resp.headers); headers.set('Access-Control-Allow-Origin', '*'); headers.set('Access-Control-Allow-Methods', 'GET'); headers.set('Access-Control-Allow-Headers', 'Content-Type'); return headers; }还有一个个nginx版本server { listen 80; listen [::]:80; server_name loc.xiu.ee; #SSL Configuration listen 443 ssl; listen [::]:443 ssl; ssl_certificate /ssl/loc.xiu.ee.crt; ssl_certificate_key /ssl/loc.xiu.ee.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; if ($scheme = http) { return 301 https://$server_name$request_uri; } # proxy to another site location ~/ { proxy_pass https://hostloc.com; proxy_set_header Host hostloc.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header referer https://hostloc.com/$request_uri; proxy_set_header Accept-Encoding ""; proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0"; sub_filter_types *; sub_filter ' ' ' '; sub_filter 'hostloc.com' 'loc.xiu.ee'; sub_filter ' ' ' '; sub_filter_once off; set $static_fileEJLfi5A0 0; if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" ) { set $static_fileEJLfi5A0 1; expires 12h; } if ( $static_fileEJLfi5A0 = 0 ) { add_header Cache-Control no-cache; } } }
用CFworkers部署的所以不用担心泄露账号密码问题
用CFworkers部署的所以不用担心泄露账号密码问题所有功能正常源码：https://bijici.com/6wmzHviewhttps://hostloc.us/备份：addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); }); const TARGET_URL = "https://hostloc.com"; const TARGET_URL_REGEXP = /hostloc\.com/g; const TARGET_HOSTNAME = new URL(TARGET_URL).hostname; const handleRequest = async request => { const url = new URL(request.url); url.hostname = TARGET_HOSTNAME; let headers = new Headers(request.headers); headers.set("Referer", TARGET_URL); headers.set("User-Agent", request.headers.get("user-agent")); const param = { method: request.method, headers: headers, body: request.body, redirect: "manual" } const response = await fetch(url, param); return handleResponse(request, response); } const handleResponse = async (request, response) => { const contentType = response.headers.get('content-type'); let headers = new Headers(response.headers); headers.set('Access-Control-Allow-Origin', '*'); headers.set('Access-Control-Allow-Methods', 'GET'); headers.set('Access-Control-Allow-Headers', 'Content-Type'); let location = response.headers.get('location'); if (location) { location = location.replace(TARGET_URL_REGEXP, new URL(request.url).hostname); headers.set('location', location); } const data = (contentType && contentType.includes('text')) ? await response.text() : await response.blob(); const modifiedData = (typeof data === 'string') ? data.replace(TARGET_URL_REGEXP, new URL(request.url).hostname) : data; return new Response(modifiedData, { status: response.status, statusText: response.statusText, headers: headers }); }PS：我自己也弄了一个反代：https://mjj.513513.xyz
Files 是一个单文件PHP应用程序，可以将它放入服务器上的任何文件夹中，立即创建一个文件和文件夹库。它支持所有的文件类型，并允许您预览图像，视频，音频和文本文件。File 浏览器：即时浏览文件和文件夹，无需复杂的安装。分享：方便地与客户、朋友和家人分享文件和照片。画廊：使用作为一个简单而美丽的现代画廊为您的网站。File 管理：不使用 FTP 直接在服务器上上传和管理文件和文件夹。官网：https://www.files.gallery/体验：https://demo.files.gallery/ 功能：下载地址：https://priapus.lanzouy.com/iK2Du0bvg56f 解锁所有功能本站备份下载： 'files.gallery-0.7.0 .zip' 大小：. 93.5 KB | . 下载次数: 511 下载附件 本站官方源码下载： 'files.gallery-0.7.0官方.rar' 大小：. 23.3 KB | . 下载次数: 511 下载附件 没任何后台，要是怀疑有我后门，可以自己去和官方的源码做对比，很容易对比出来我改了哪里了，我就加了一点点（不到3行）的代码，比其他人纯...当然，现在有更好的替代品 alist ：https://github.com/alist-org/alist