support only GET/DELETE methods

This commit is contained in:
m5r
2025-09-20 14:50:27 +02:00
parent a3d639df6c
commit 59b2e3eef0
2 changed files with 28 additions and 0 deletions

View File

@@ -9,6 +9,17 @@ export { RulesCache };
export default {
async fetch(request, env, ctx): Promise<Response> {
if (request.method !== "GET" && request.method !== "DELETE") {
return new Response("Method not allowed", {
status: 405,
headers: {
"Allow": "GET, DELETE",
"Content-Type": "text/plain",
"Access-Control-Allow-Origin": "*",
}
});
}
const url = new URL(request.url);
const targetUrl = url.searchParams.get("url");