On this page

Reverse proxy middleware

This quickstart will cover how to deploy a small piece of middleware that reverse proxies another server (in this case example.com). For additional examples of common middleware functions, see the example gallery.

Step 1: Create a new playground project on Deno Deploy Jump to heading

Navigate to https://dash.deno.com/projects and click on the "New Playground" button.

Step 2: Deploy middleware code via playground Jump to heading

On the next page, copy and paste the code below into the editor. It is an HTTP server that proxies all requests to https://example.com.

async function reqHandler(req: Request) {
  const reqPath = new URL(req.url).pathname;
  return await fetch("https://example.com" + reqPath, { headers: req.headers });


Click Save and Deploy.

You should see something like this: