File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/script.js Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ import type { NextRequest } from 'next/server';
77
88export const dynamic = 'force-static' ;
99
10+ const EMBEDDABLE_RESPONSE_HEADERS = {
11+ 'Access-Control-Allow-Origin' : '*' ,
12+ 'Access-Control-Allow-Methods' : 'GET, OPTIONS' ,
13+ 'Cross-Origin-Resource-Policy' : 'cross-origin' ,
14+ 'Cache-Control' : 'public, max-age=86400, stale-while-revalidate=604800' ,
15+ } ;
16+
1017/**
1118 * This route is used to serve the assistant.js script.
1219 */
@@ -69,9 +76,16 @@ export async function GET(
6976 ` ,
7077 {
7178 headers : {
79+ ...EMBEDDABLE_RESPONSE_HEADERS ,
7280 'Content-Type' : 'application/javascript' ,
73- 'Cache-Control' : 'public, max-age=86400, stale-while-revalidate=604800' ,
7481 } ,
7582 }
7683 ) ;
7784}
85+
86+ export function OPTIONS ( ) {
87+ return new Response ( null , {
88+ status : 204 ,
89+ headers : EMBEDDABLE_RESPONSE_HEADERS ,
90+ } ) ;
91+ }
You can’t perform that action at this time.
0 commit comments