需要准备一个托管到CF的域名
在这里创建一个workers脚本,内容如下
addEventListener("fetch", event => {
let url = new URL(event.request.url);
if (url.pathname == "/test" && url.search == "") {
url.href="https://cachefly.cachefly.net/200mb.test"
let request = new Request(url, event.request);
event.respondWith(fetch(request));
}
})
之后点击保存并部署,看到200的http相应即可
接下来添加自定义域(custom domain)
不需要创建任何类型的实例,直接写出,例如0823.ppp.com,你只需要保证 ppp.com在你的CF上托管即可,证书会自动配置
保存之后就可以通过https://0823.ppp.com/test下载文件,其中/test你可以在脚本中自定义,这只是一个重定向到https://cachefly.cachefly.net/200mb.test的监听脚本,你也可以用50mb