Featured

* [Add web analytics](https://developers.cloudflare.com/web-analytics/)
* [Troubleshoot errors](https://developers.cloudflare.com/support/troubleshooting/cloudflare-errors/)
* [Register a domain](https://developers.cloudflare.com/registrar/)
* [Setup 1.1.1.1](https://developers.cloudflare.com/1.1.1.1/setup/)
* [Get started with Cloudflare](https://developers.cloudflare.com/learning-paths/get-started/concepts/)

**[View all products](https://developers.cloudflare.com/products/)**

Developer Products

* [Workers](https://developers.cloudflare.com/workers/)
* [Pages](https://developers.cloudflare.com/pages/)
* [R2](https://developers.cloudflare.com/r2/)
* [Images](https://developers.cloudflare.com/images/)
* [Stream](https://developers.cloudflare.com/stream/)

**[View all developer products](https://developers.cloudflare.com/products/?product-group=Developer+platform)**

AI Products

* [Build a RAG app](https://developers.cloudflare.com/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/)
* [Workers AI](https://developers.cloudflare.com/workers-ai/)
* [Vectorize](https://developers.cloudflare.com/vectorize/)
* [AI Gateway](https://developers.cloudflare.com/ai-gateway/)
* [AI Playground](https://playground.ai.cloudflare.com/)

**[View all AI products](https://developers.cloudflare.com/products/?product-group=AI)**

Zero Trust

* [Access](https://developers.cloudflare.com/cloudflare-one/policies/access/)
* [Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/)
* [Gateway](https://developers.cloudflare.com/cloudflare-one/policies/gateway/)
* [Browser Isolation](https://developers.cloudflare.com/cloudflare-one/policies/browser-isolation/)
* [Replace your VPN](https://developers.cloudflare.com/learning-paths/replace-vpn/concepts/)

**[View all Cloudflare One products](https://developers.cloudflare.com/products/?product-group=Cloudflare+One)**

***

## Build with Cloudflare

```js
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 in Playground](https://workers.cloudflare.com/playground#LYVwNgLglgDghgJwgegGYHsHALQBM4RwDcABAEbogB2+CAngLzbPYZb6HbW5QDGU2AAwB2AKziAzKICcAFkETZALhYs2wDnC40+AkeNFS5C2QFgAUAGF0VCAFNb2ACJQAzjHSuo0G0pLq8AmISKjhgOwYAIigaOwAPADoAK1dI0lQoMAcwiOjYxJTIi2tbBwhsABU6GDs-OBgYMD4CKBtkJLgANzhXXgRYCABqYHRccDsLC3iPJBJcO1Q4cAgSAG9zEhIeuipefzsIXgALAAoEOwBHEDtXCABKNY3Nkl4bW5IjiGAwEgYSAAMADwAQicAHlLBUAJoABQAoh8vmAAHxPTaAii4Oio57PQFHACMyIAEnYwGB0CQAOqYMC4QHIQk43EkQEwZEVI5uEjARAAaxAMBIAHceiQAOYOOwIAh2XDkOhbEiWCkgXCoMCIOzUzB86UJBnstGs5CY7H-IjmY3nCAgBBUEJ2YUkABKNw8VFcdhOn2+ABpHiyPnY4PMEK4-Osg5tIq9So4INU7JE-JF7HEUL6wERjogvRAGABVCoAMWwAA5In7jZsAL7V3G1u6WuvV2tECyqZjqTTaHj8IRiSQyeSKYo2eyOFzuTzeVpUPwBTSkULhKLhQiaNL+TLZNeRMgUshFKwTsqVJN1BpNXgtNopGyTcyrSK8mIAfRGYyyKby8wKqS1p2XY9kEfa6IOBhGKOsjMEAA)

```js
export default {
  async fetch(request) {
    const data = {
      hello: "world",
    };


    return Response.json(data);
  },
};
```

[Run Worker in Playground](https://workers.cloudflare.com/playground#LYVwNgLglgDghgJwgegGYHsHALQBM4RwDcABAEbogB2+CAngLzbPYZb6HbW5QDGU2AAwBOYQCZBARkmCxwyQFYAXCxZtgHOFxp8BI8VJlzFAWABQAYXRUIAUxvYAIlADOMdC6jRrSkurwExCRUcMC2DABEUDS2AB4AdABWLhGkqFBg9qHhUTEJyRHmVjb2ENgAKnQwtr5wMDBgfARQ1siJcABucC68CLAQANTA6Ljgtubmce5IJLi2qHDgECQA3mYkJN10VLx+thC8ABYAFAi2AI4gti4QAJSr6xskvNY3s4EkDA9PT4e2YGB0L4IgB3TBgXARAA0jw2AF8iGZYSQzhAQAgqCQAErXdxUFy2JIuazHTS3RHwmEI8yqZjqTTaHj8ISiCTSWTyBRFax2BzONweLwtKi+fyaUghMKRMKETSpPwZLJSiJkQFkQqWHmlCpVGqbeqNXjNVrJawTMwrCLAODRAD6w1GmQiSlyc3yKThNNp9MCjN0LIM7OMCmYQA)

```js
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 in Playground](https://workers.cloudflare.com/playground#LYVwNgLglgDghgJwgegGYHsHALQBM4RwDcABAEbogB2+CAngLzbPYZb6HbW5QDGU2AAwB2YQBYAjAGYJAVmEA2BQCYAXCxZtgHOFxp8BI8dLmKVAWABQAYXRUIAU3vYAIlADOMdO6jQ7qki08AmISKjhgBwYAIigaBwAPADoAK3do0lQoMCcIqNj45LToq1t7JwhsABU6GAcAuBgYMD4CKDtkFLgANzh3XgRYCABqYHRccAcrK0SvJBJcB1Q4cAgSAG9LEhI+uipeQIcIXgALAAoEBwBHEAd3CABKDa3tkmQAKneX1-eSACUHM04LwHCQAAaXMaOMEkADuvhOJAgJ1BJ28azolDhHkREHQJHcTlwJEuNzuEHcSPQ32272QNN4dnuJIcUNBDBI0ROEAgMHcqmQyESEWaDiSjOAGUsNMuEBACCoO1hcF8h2O50h6EcABoWWT7g8iC8AL7ayzGohWDTMLQ6PQ8fhCUSSGTyJTKUp2RzONyeby+dpUAJBHSkcKRGKRQg6DKBbK5CPRMhgdBkEo2L0Vaq1eo7JotXhtDppOzTSzraLAFVUAD6YwmOWiqgKiyK6WNVuttpC9oMTuMrrMymYQA)

```js
export default {
  async fetch(request) {
    const destinationURL = "https://example.com";
    const statusCode = 301;
    return Response.redirect(destinationURL, statusCode);
  },
};
```

[Run Worker in Playground](https://workers.cloudflare.com/playground#LYVwNgLglgDghgJwgegGYHsHALQBM4RwDcABAEbogB2+CAngLzbPYZb6HbW5QDGU2AAwBmAIwAmcYICsATlnDZ4gFwsWbYBzhcafASIlS5CpQFgAUAGF0VCAFNb2ACJQAzjHSuo0G8pIa8AmISKjhgOwYAIigaOwAPADoAK1dI0lQoMAcwiOjYxJTIi2tbBwhsABU6GDs-OBgYMD4CKBtkJLgANzhXXgRYCABqYHRccDsLC3iPJBJcO1Q4cAgSAG9zEhIeuipefzsIXgALAAoEOwBHEDtXCABKNY3Nkl4bW7mb6FCfKgBVACUADIkBgkSJHCAQGCuZTIZDxMKNOwJV7ANJPTavKjvW4EECuazzEEkYSCUREDEkc4QEAIKgkf43DzY5HnHjnXgQE7zW4xFo2AGAgA0JFxNIJozsdwpmwAvkLzLKiBY1MwNFodDx+EIxJIZPJFOJijZ7I4XO5PN5WlQ-AEtKRQuEouFCFo0v5MtknZEyGB0GQilYTWVKtValsGk1ePyqO1XDZJuZVpFgHAYgB9EZjLKRZR5eYFVKylWq9VBTV6HWGfUmcTMIA)

```js
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`);
  },
};
```

[Run Worker in Playground](https://workers.cloudflare.com/playground#LYVwNgLglgDghgJwgegGYHsHALQBM4RwDcABAEbogB2+CAngLzbPYZb6HbW5QDGU2AAwAWAKzCAnKPEBGQQA5RALhYs2wDnC40+AkeKmyFogLAAoAMLoqEAKY3sAESgBnGOhdRo1pSXV4CYhIqOGBbBgAiKBpbAA8AOgArFwjSVCgwe1DwqJiE5IjzKxt7CGwAFToYW184GBgwPgIoa2REuAA3OBdeBFgIAGpgdFxwW3NzOPckElxbVDhwCBIAbzMSEm66Kl4-WwheAAsACgRbAEcQWxcIAEpV9Y3Nl23d1GpebyoSAFl9w5GADl0BAAIJgMDoADutlwpwuVxu9zWTyeZwgIAQ3yotihJAAStd3FQXLZjgADP4QAG4EgAEhWZ0u1wg8TC1JGAF9giDNhDobD4uSADQPVGom4EEAuXzCQSiYWPcUkQ62OBzBAysXKp7gyFQ3wRADiAFFyhFFTqSJzLeLObciErrU7kMgSAB5KhgOgkU3lEhMxEQFwkKGYADWoa8hxI1NcJBgCHQsTo8SdUFQJHhzJubP+IxIAEIGAwSMazRF7ujMd8qTTgWD+TC4YGWQ6ndWsXsDidyYcIBAYDLXXFQg1bPFeOhgOT2xsbWZOURzKpmOpNNoePwhGJJNJhHJFEVrHYHM43B4vC0qL5-JpSCEwpF2erAqk-Bksk+ImRIWRCpYJ6lBUVQ1Js9SNLwzStMk1gTGYKwRMAcDRAA+sMoyZBESi5HM+QpJyK6ruugSbroO4GPuh6iMwQA)

[Learn more about Workers](https://developers.cloudflare.com/workers/)

***

![Developer Platform section image](https://developers.cloudflare.com/_astro/developer-platform-light.CZoHB6oh_20sfhS.svg) ![Developer Platform section image](https://developers.cloudflare.com/_astro/developer-platform-dark.ChPufHpV_Z23McgK.svg)

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

[Explore our Developer Platform](https://developers.cloudflare.com/products/?product-group=Developer+platform)

***

Install the WARP Client

The Cloudflare WARP client allows individuals and organizations to have a faster, more secure, and more private experience online.



[Get started](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/)

Set up a tunnel

Cloudflare Tunnel provides you with a secure way to connect your resources to Cloudflare without a publicly routable IP address.



[Set up a tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/)

![Zero Trust section image](https://developers.cloudflare.com/_astro/zero-trust-light.BvZ3bzoV_Z9uUsr.svg) ![Zero Trust section image](https://developers.cloudflare.com/_astro/zero-trust-dark.Dary5ape_ZAefa.svg)

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



[Install Origin CA](https://developers.cloudflare.com/ssl/origin-configuration/origin-ca/)

Change your nameservers

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



[Update nameservers](https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/)

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.



[Set encryption mode](https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/)

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



[Allow traffic from specific countries only](https://developers.cloudflare.com/waf/custom-rules/use-cases/allow-traffic-from-specific-countries/)

***

**Community**

Share ideas, answers, code and compare notes with the Cloudflare community.

* [Discord](https://discord.cloudflare.com/)
* [Twitter](https://x.com/CloudflareDev)
* [Community forum](https://community.cloudflare.com/)

**Open source**

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

* [GitHub projects](https://github.com/cloudflare)
* [Sponsorship projects](https://developers.cloudflare.com/sponsorships/)
* [Style guide](https://developers.cloudflare.com/style-guide/)

**Blog**

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

* [Read the blog](https://blog.cloudflare.com/)
