node:crypto. Which modules do you need?content-disposition header (it looks like you're making the request with the header, which is different)text/plain, in your example I could do a contentType query param of video/webm and the browser would think my text file is a videofetch(url), and another 1000 to in-house things (KV, R2, DO, D1, you get the idea)try/catch around the subrequeste.name === "subrequest limit exceeded"?export interface Env {
BUCKET_URL_AUTH_GENERATION_KEY: string;
BUCKET_URL_SYMMETRIC_KEY: string;
}
export default {
async fetch(request: Request, env: Env,): Promise<Response> {
if (!env.BUCKET_URL_AUTH_GENERATION_KEY || !env.BUCKET_URL_SYMMETRIC_KEY) {
return new Response("Missing required environment variables", { status: 500 });
}node:cryptoconst newRequest = new Request(request);
const contentType = url.searchParams.get("content-type");
if (contentType) {
newRequest.headers.set("Content-Type", contentType);
}
const contentDisposition = url.searchParams.get("content-disposition");
if (contentDisposition) {
newRequest.headers.set("Content-Disposition", contentDisposition);
}
return fetch(new URL(url.pathname, `https://${requiredHostname}`), newRequest);content-dispositiontext/plaincontentTypevideo/webmfetch(url)try/catche.name === "subrequest limit exceeded"const res = fetch(new URL(url.pathname, `https://${requiredHostname}`));
// Clone the response because it's immutable by default.
const clonedRes = new Response(res.body, res);
clonedRes.headers.set("Content-Disposition", contentDisposition);
clonedRes.headers.set("Content-Type", contentType);
return clonedResexport default {
async fetch() {
try {
while (true) { await fetch("https://cloudflare.com/cdn-cgi/trace") }
} catch (e) {
return new Response(JSON.stringify(e, Object.getOwnPropertyNames(e)))
}
},
};