CDN System

So i need a little help so basically i got this discord bot module script here:
6 Replies
Cosmo
CosmoOP2mo ago
I have my workers script here: export default { async fetch(request, env) { const url = new URL(request.url); const path = url.pathname.substring(1); // Remove leading "/" const apiKey = request.headers.get('Authorization'); // Get API key from headers switch (request.method) { case "PUT": if (apiKey !== 'this is correct dont worry.') { return new Response('401 Unauthorized', { status: 401 }); } await env.CDN_BUCKET.put(path, request.body); return new Response(File ${path} uploaded successfully!); case "GET": const object = await env.CDN_BUCKET.get(path); if (!object) return new Response("404 File Not Found", { status: 404 }); return new Response(object.body, { headers: { "Content-Type": object.httpMetadata?.contentType || "application/octet-stream" } }); default: return new Response("405 Method Not Allowed", { status: 405, headers: { "Allow": "PUT, GET" } }); } } }; and that there is my discord bot module but for some damn reason it doesnt work.. get works fine but upload keeps saying 400
Cosmo
CosmoOP2mo ago
Cosmo
CosmoOP2mo ago
i had to reupload. So basically i have that
Cosmo
CosmoOP2mo ago
Cosmo
CosmoOP2mo ago
and that there is the discord commadn that is running it for some reason it just keeps saying code 400 if somebody can provide me a code that would be useful ?support
SuperHelpflare
SuperHelpflare2mo ago
To contact Cloudflare Support about an issue, please visit the Support Portal and fill in the form on the portal. After submission, you will receive confirmation over email. Some issues, such as Account or Billing related issues, cannot be solved by the community. Any plan level (including Free plans) can open tickets for Account, Billing or Registrar ticket categories. Make sure to select the correct category to ensure it goes to the right place. For more information on the methods by which you can contact Support for your plan level, see Contacting Cloudflare Support - Cloudflare Docs

Did you find this page helpful?