diff --git a/packages/server/src/handlers.ts b/packages/server/src/handlers.ts index d7a30c6..33ac9e5 100644 --- a/packages/server/src/handlers.ts +++ b/packages/server/src/handlers.ts @@ -72,6 +72,14 @@ export async function handleMedia(req: Request) { const media = await fetch(url, { headers: getProxySafeMediaHeaders(req), }); + + if (!media.ok) { + return new Response(media.body, { + headers: { ...CORS_HEADERS }, + status: media.status, + }); + } + // This will include the cache control headers const mediaHeaders = Object.fromEntries(media.headers.entries()); const responseHeaders = new Headers({ ...mediaHeaders, ...CORS_HEADERS });