|
|
|
准备一个cf账号,一个域名并接入
添加一个A记录,随便解析,打开小云朵。
回到首页,点开左边的worker和pages。
根据提示,创建一个应用程序→部署→编辑代码,全选覆盖并保存部署。
- addEventListener('fetch', event => { event.respondWith(handleRequest(event.request))})async function handleRequest(request) { const newUrl = request.url.replace("https://你的域名/https://", "https://") const response = await fetch(newUrl) // you may want to add caching headers here to improve performance // as well as handling errors if the upstream server is down return response}
复制代码
【注意替换域名,要拉的如果是http,则修改域名后面对应的https】
点开刚部署的worker,在触发器→自定义域里添加刚刚的域名。
接着点下面的添加路由,填入刚解析的域名,示范:a.b.com/*,然后保存。
最后测试下,https://域名/https://speed.hetzner.de/100MB.bin
应用场景:拉github,拉civitai/huggingface模型,省去开代理的麻烦。 |
|