diff options
author | 2024-05-23 10:45:03 +0200 | |
---|---|---|
committer | 2024-05-23 10:45:03 +0200 | |
commit | 9a0e94b2e6bc41b370d8a0518004c6f3cb1b833e (patch) | |
tree | f2a1f62a825ad57dd21e6e87a3f0c8663c789ded | |
parent | 9566fa08608be766df355be17d72a39ea7b99ed0 (diff) | |
download | astro-9a0e94b2e6bc41b370d8a0518004c6f3cb1b833e.tar.gz astro-9a0e94b2e6bc41b370d8a0518004c6f3cb1b833e.tar.zst astro-9a0e94b2e6bc41b370d8a0518004c6f3cb1b833e.zip |
Let web vitals route handle all requests under that path (#11120)
-rw-r--r-- | .changeset/three-bikes-stare.md | 5 | ||||
-rw-r--r-- | packages/integrations/web-vitals/src/index.ts | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/three-bikes-stare.md b/.changeset/three-bikes-stare.md new file mode 100644 index 000000000..bc5915b92 --- /dev/null +++ b/.changeset/three-bikes-stare.md @@ -0,0 +1,5 @@ +--- +"@astrojs/web-vitals": patch +--- + +Fixes requests to the web vitals endpoint in setups like Vercel’s `trailingSlash: true` that redirect from `/web-vitals` to `/web-vitals/` diff --git a/packages/integrations/web-vitals/src/index.ts b/packages/integrations/web-vitals/src/index.ts index a93358266..f5c1c72a2 100644 --- a/packages/integrations/web-vitals/src/index.ts +++ b/packages/integrations/web-vitals/src/index.ts @@ -32,7 +32,7 @@ export default function webVitals({ deprecated }: { deprecated?: boolean } = {}) // Endpoint that collects metrics and inserts them in Astro DB. injectRoute({ entrypoint: '@astrojs/web-vitals/endpoint', - pattern: WEB_VITALS_ENDPOINT_PATH, + pattern: WEB_VITALS_ENDPOINT_PATH + '/[...any]', prerender: false, }); // Client-side performance measurement script. |