diff --git a/src/lib/api.ts b/src/lib/api.ts index 4ad18dd12..c5d0924e4 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -68,7 +68,10 @@ export const getPublishedContentByUrl = cache( secure: false, format: 'json', signal: signal, - cache: 'no-store', + // Cloudflare doesn't support the `cache` directive before next-on-pages patches the fetch function + // https://github.com/cloudflare/workerd/issues/698 + // cache: 'no-store', + next: { revalidate: 0 }, }); return cacheResponse(response); diff --git a/src/middleware.ts b/src/middleware.ts index af0b0b704..948694480 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -53,6 +53,7 @@ export async function middleware(request: NextRequest) { console.log(`rendering ${resolved.space} ${resolved.pathname}`); const headers = new Headers(request.headers); + headers.set('origin', inputURL.origin); headers.set('x-gitbook-token', resolved.apiToken); headers.set('x-gitbook-basepath', joinPath(proxyBasePath, resolved.basePath)); if (apiEndpoint) {