From db4fc7b8ee6fb54f245b6d4db6fcce714419861d Mon Sep 17 00:00:00 2001 From: Asvin Jain Date: Thu, 5 Oct 2023 13:17:44 +0530 Subject: [PATCH] Added cloudflare worker --- src/worker.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/worker.js diff --git a/src/worker.js b/src/worker.js new file mode 100644 index 00000000..577db2dd --- /dev/null +++ b/src/worker.js @@ -0,0 +1,17 @@ +export default { + async fetch(request) { + async function MethodNotAllowed(request) { + return new Response(`Method ${request.method} not allowed.`, { + status: 405, + headers: { + Allow: "GET", + }, + }); + } + // Only GET requests work with this proxy. + if (request.method !== "GET") return MethodNotAllowed(request); + var uri=request.url.substring((request.url.toString()).lastIndexOf('.dev') + 5) + return fetch(uri); + }, + }; + \ No newline at end of file