Build with Cloudflare
exportdefault{asyncfetch(request){consthtml=`<!DOCTYPE html><body><h1>Hello World</h1><p>This markup was generated by a Cloudflare Worker.</p></body>`;returnnewResponse(html,{headers:{"content-type":"text/html;charset=UTF-8",},});},};exportdefault{asyncfetch(request){constdata={hello:"world",};returnResponse.json(data);},};exportdefault{asyncfetch(request){/*** Replace `remote` with the host you wish to send requests to*/constremote="https://example.com";returnawaitfetch(remote,request);},};exportdefault{asyncfetch(request){constdestinationURL="https://example.com";conststatusCode=301;returnResponse.redirect(destinationURL,statusCode);},};exportdefault{asyncfetch(request){functionMethodNotAllowed(request){returnnewResponse(`Method${request.method} not allowed.`,{status:405,headers:{Allow:"GET",},});}// Only GET requests work with this proxy.if (request.method!=="GET")returnMethodNotAllowed(request);returnfetch(`https://example.com`);},};Developer Platform
The Cloudflare Developer Platform provides a serverless execution environment that allows you to create entirely new applications or augment existing ones without configuring or maintaining infrastructure.
Zero Trust
Cloudflare Zero Trust replaces legacy security perimeters with our global network, making the Internet faster and safer for teams around the world.
Other docs you might also like
Install an Origin CA certificate
Use Origin Certificate Authority (CA) certificates to encrypt traffic between Cloudflare and your origin web server and reduce origin bandwidth.
Change your nameservers
Make Cloudflare your primary DNS provider by updating your authoritative nameservers at your domain registrar.
SSL/TLS Encryption mode
Your domain's encryption mode controls how Cloudflare connects to your origin server and how SSL certificates at your origin will be validated.
Allow traffic from specific countries only
Block requests based on a list of allowed countries by configuring a custom rule in the Web Application Firewall (WAF).
Share ideas, answers, code and compare notes with the Cloudflare community.
Cloudflare contributes to the open-source ecosystem in a variety of ways, including:
Get the latest news on Cloudflare products, technologies, and culture.