LabbedRat
LabbedRat
CDCloudflare Developers
Created by LabbedRat on 3/20/2025 in #workers-help
Specifying a method for a worker route
Hello! I am using workers to run a specific script for a specific method at a given route (for example website.com/specific-route). In order to to this I currently run this check in the worker:
if (request.method !== "POST") {
return Response.json("", { status: 405 });
}
if (request.method !== "POST") {
return Response.json("", { status: 405 });
}
However I am worried that even when called with a GET for example, this will still count as a worker invokation for billing purposes. Is there a way to restrict a worker route for a specific method?
4 replies