Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Fetch Handler · Cloudflare Workers docs
[go: Go Back, main page]

Skip to content
Cloudflare Docs

Fetch Handler

Background

Incoming HTTP requests to a Worker are passed to the fetch() handler as a Request object. To respond to the request with a response, return a Response object:

export default {
async fetch(request, env, ctx) {
return new Response('Hello World!');
},
};

Parameters

  • request Request

    • The incoming HTTP request.
  • env object

    • The bindings available to the Worker. As long as the environment has not changed, the same object (equal by identity) may be passed to multiple requests.
  • ctx.waitUntil(promisePromise) : void

  • ctx.passThroughOnException() : void