Skip to content

IndexNow for Cloudflare

Easy

Serve the key file at the edge with a Worker or a Redirect Rule — no origin changes.

If your origin is hard to change, Cloudflare can answer the key file request itself. This works for any site behind Cloudflare, whatever the backend.

Step by step

  1. 1 In the Cloudflare dashboard, open Workers & Pages → Create → Worker.
  2. 2 Paste the code below, replacing the key if needed.
  3. 3 Deploy the Worker, then add a route: yourdomain.com/a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6.txt
  4. 4 Confirm the URL loads in a browser, then click Verify.

Cloudflare Worker

const KEY = 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6'

export default {
  async fetch(request) {
    const { pathname } = new URL(request.url)

    if (pathname === `/$a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6.txt`) {
      return new Response(KEY, {
        headers: { 'content-type': 'text/plain; charset=utf-8' },
      })
    }

    return fetch(request)
  },
}

The key shown is an example. Yours is generated when you add the domain.

Watch out for

  • Make sure the Worker route is on the exact hostname you added to Index-now.
  • If you use "Bot Fight Mode" or a firewall rule blocking unknown user agents, allow our verification requests.

Then what?

Hosting the key file proves you own the domain — it doesn't submit anything on its own. You still need something watching for changes and calling the IndexNow API with the right URLs at the right time. You can build that yourself, or let us run it for $12 a year.

Set up automatic submission

Stop waiting to be found

Set it up once. We keep telling the search engines about every change you make, for $12 a year.