Skip to content

Skip prefixes over-match: /admin also skips /administrator (cloudflare, netlify, vercel) #82

Description

@abhay-codes07

Summary

The cloudflare, netlify and vercel adapters test skip prefixes with a bare startsWith, so a prefix over-matches any path that merely starts with the same characters. With the default DEFAULT_SKIP_PREFIXES = ["/admin", "/api/", "/_"], a real page like /administrator (or /admins, /admin-guide) matches /admin and is silently skipped: no content negotiation, no markdown twin, no Link header.

Where

// packages/cloudflare/src/worker.ts, packages/netlify/src/worker.ts, packages/vercel/src/middleware.ts
return prefixes.some((p) => pathname.startsWith(p));

The deno and fastly adapters already use a boundary-aware check (packages/deno/src/handler.ts):

return prefixes.some((p) => {
  if (pathname === p) return true;
  if (p.endsWith("/")) return pathname.startsWith(p);
  return pathname.startsWith(p + "/");
});

Reproduction

import { createAEOWorker } from "@dualmark/cloudflare";
// ASSETS has /administrator.md
// GET /administrator with a bot UA
// actual:   text/html (skipped, twin ignored)
// expected: text/markdown (negotiated)

Proposed fix

Adopt the same boundary-aware shouldSkip used by deno/fastly in cloudflare, netlify and vercel. A prefix matches the exact path or a prefix/ subpath; a prefix already ending in / keeps matching via startsWith; asset paths under /_ remain covered by the extension list. PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions