Fetch Handler
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!'); },};
-
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- Refer to
waitUntil
.
- Refer to
-
ctx.passThroughOnException()
: void- Refer to
passThroughOnException
.
- Refer to
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark