AFAIK, never. Some APIs don’t make sense in a serverless context, or the way Workers works in partic
AFAIK, never. Some APIs don’t make sense in a serverless context, or the way Workers works in particular
dotenv to be a string of .env.env file.dev.vars[vars] and you upload secrets with wrangler secret putnode: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).dev.vars[vars]wrangler secret putexport 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)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 clonedRes