silverwolf-x's picture
download
raw
580 Bytes
// TODO: set origin here
const SOURCE_IMAGE_ORIGIN = "https://image-optimization-one.vercel.app";
export async function GET(req: Request) {
if (!req.headers.get("user-agent")) {
// TODO: add any other checks here
return new Response("Forbidden", { status: 403 });
}
const path = new URL(req.url).pathname.slice("/image-api".length);
if (!path) {
return new Response("Bad Request", { status: 400 });
}
const res = await fetch(new URL(path, SOURCE_IMAGE_ORIGIN));
const { status, headers, body } = res;
return new Response(body, { status, headers });
}

Xet Storage Details

Size:
580 Bytes
·
Xet hash:
571bc6bce00468114d802a0cefe773b6c84941f1050822c54ebf9a041e7eb08d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.