Welcome to Cloudflare

Explore guides and tutorials to start building on Cloudflare's platform

Build with Cloudflare

 Run Worker
export default {
async fetch(request) {
const html = `<!DOCTYPE html>
<body>
<h1>Hello World</h1>
<p>This markup was generated by a Cloudflare Worker.</p>
</body>`;
return new Response(html, {
headers: {
"content-type": "text/html;charset=UTF-8",
},
});
},
};
 Run Worker
export default {
async fetch(request) {
const data = {
hello: "world",
};
return Response.json(data);
},
};
 Run Worker
export default {
async fetch(request) {
/**
* Replace `remote` with the host you wish to send requests to
*/
const remote = "https://example.com";
return await fetch(remote, request);
},
};
 Run Worker
export default {
async fetch(request) {
const destinationURL = "https://example.com";
const statusCode = 301;
return Response.redirect(destinationURL, statusCode);
},
};
 Run Worker
export default {
async fetch(request) {
async function MethodNotAllowed(request) {
return new Response(`Method ${request.method} not allowed.`, {
status: 405,
headers: {
Allow: "GET",
},
});
}
// Only GET requests work with this proxy.
if (request.method !== "GET") return MethodNotAllowed(request);
return fetch(`https://example.com`);
},
};
Developer Platform

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.

Create API Tokens

If you are going to be using the Cloudflare API, you first need an API token to authenticate your requests.

Create Tokens >

View Workers Examples

Review fully functional sample scripts to get started with Workers.

View Examples >

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 consumption.

Install Origin CA >

Change your nameservers

Make Cloudflare your primary DNS provider by updating your authoritative nameservers at your domain registrar.

Update nameservers >

SSL/TLS Encryption mode

Your domain's SSL/TLS encryption mode controls how Cloudflare connects to your origin web server and how SSL certificates presented by your origin will be validated.

Set encryption mode >

Create IP access rules

Use IP Access rules to allowlist, block, and challenge traffic based on the visitor’s IP address, country, or Autonomous System Number (ASN).

Create IP access rules >

​​ Community

The Cloudflare community is a place for Cloudflare users to share ideas, answers, code and compare notes.

discord

Discord

twitter

Twitter

community

Community Forum

​​ Open source

Cloudflare contributes to the open-source ecosystem in a variety of ways, including:

github

GitHub Projects

sponsor

Sponsorship Projects

style-guide

Style Guide

​​ Blog

Get the latest news on Cloudflare products, technologies, and culture.

blog

Read the blog