使用 Cloudflare 配置子目录
使用 Cloudflare 将您的文档托管在 /docs 子目录下
4
更新 worker 代码
export default {
fetch(request) {
const SUBDIRECTORY = '/docs';
const url = new URL(request.url);
const target = "<INSERT YOUR PROXY URL FROM GITBOOK>" + url.pathname.slice(SUBDIRECTORY.length);
const proxy = new URL(
target.endsWith('/') ? target.slice(0, -1) : target
)
proxy.search = url.search;
return fetch(new Request(proxy, request));
}
};最后更新于
这有帮助吗?