---
title: Fetch HTML · Cloudflare Workers docs
description: Send a request to a remote server, read HTML from the response, and serve that HTML.
lastUpdated: 2025-04-28T14:11:18.000Z
source_url:
  html: https://da735954.preview.developers.cloudflare.com/workers/examples/fetch-html/index.md
  md: https://da735954.preview.developers.cloudflare.com/workers/examples/fetch-html/
---

If you want to get started quickly, click on the button below.

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/fetch-html)

This creates a repository in your GitHub account and deploys the application to Cloudflare Workers.

* JavaScript

  ```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+CAngLzbPYZb6HbW5QDGU2AAwBOEQDYAjAA4JAZlkiAXCxZtgHOFxp8BI8dLkLhAWABQAYXRUIAU2vYAIlADOMdM6jQrikmrwFiEio4YBsGACIoGhsADwA6ACtncNJUKDA7ELDI6Pik8LNLazsIbAAVOhgbHzgYGDA+AigrZAS4ADc4Z14EWAgAamB0XHAbMzNYtyQSXBtUOHAIEgBvUxISLroqXl8bCF4ACwAKBBsARxAbZwgAShW19ZJkACpnh8fnkgAlG3q4XhsJAABqchrYgSQAO6eA4kCAHQEHdxLOiUKEuWEQdAkZx2XAkU4XK4QZxw9DvdbPZAU3hWa4EmxgwEMEjhA4QCAwZyKZDIWIheo2OK04ApUwU04QEAIKgbSFwTy7fbHUHoWwAGgZROuNyIDwAvurTPqiGYVMw1BotDx+EJRMJJDJ5CJClZbPYnK53J5mlQfH4NKRgqEIqFCBoUr50pkQ+EyGB0GQChY3SVypVqhs6g1eE0WkkrONTMtwsAFVQAPpDEYZcKKHKzPLJfVm82WgLWnR2-ROozMIA)

* TypeScript

  ```ts
  export default {
    async fetch(request: Request): Promise<Response> {
      /**
       * Replace `remote` with the host you wish to send requests to
       */
      const remote = "https://example.com";


      return await fetch(remote, request);
    },
  };
  ```

* Python

  ```py
  from js import fetch


  async def on_fetch(request):
      # Replace `remote` with the host you wish to send requests to
      remote = "https://example.com"
      return await fetch(remote, request)
  ```

* Hono

  ```ts
  import { Hono } from 'hono';


  const app = new Hono();


  app.all('*', async (c) => {
    /**
     * Replace `remote` with the host you wish to send requests to
     */
    const remote = "https://example.com";


    // Forward the request to the remote server
    return await fetch(remote, c.req.raw);
  });


  export default app;
  ```
