Edge function not called on each request, logs not showing

Hi !
I am new to edge functions and tried to create a simple referrer check before displaying the website.
I deployed it to production to check if it was working, and it seems the logs are not showing consistently, and the edge function is not called on each request.
Am i missing something about edge functions ?
I thought it was some kind of hook before the request is passed to the website.

Here is the code I am using:

import { Context } from "@netlify/edge-functions"

const acceptList = [

export default async (request: Request, context: Context) => {

  // get HTTP referrer header value
  const referrer = request.headers.get("referrer") ?? request.headers.get("referer")
  console.log('Got a request coming from referrer: ', referrer)

  // if referrer included in acceptList, return response
  if (acceptList.some(url => referrer?.startsWith(url))) {
    console.log('referrer ok. Sending back response.');

    // get the next HTTP response in the chain
    const response = await context.next()

    return response

  // Else return 404
  console.log('Wrong referrer, sending back 404.');
  return new Response("Page not found", {
    headers: { "content-type": "text/html" },
    status: 404


Have you added the path: Edge Functions declarations | Netlify Docs?

Yes, here is my netlify.toml

  path = "/"
  function = "referer"

Feel free to let us know the site name, without which there’s not a lot we can check.