Skip to content

Exclude /ingest from middleware matcher#950

Merged
rchlfryn merged 1 commit intomainfrom
exclude-post-hog-events
Feb 18, 2026
Merged

Exclude /ingest from middleware matcher#950
rchlfryn merged 1 commit intomainfrom
exclude-post-hog-events

Conversation

@rchlfryn
Copy link
Copy Markdown
Collaborator

Description

Exclude PostHog /ingest paths from middleware to reduce unnecessary edge invocations and Vercel usage.

I was able to confirm on Posthog that page views events alone. This might be related to the current avalanche warnings in Tahoe.
Screenshot 2026-02-18 at 10 29 21

Related Issues

Production usage alerts — Edge Requests up 4.82x, Function Invocations up 4.37x, CPU Duration up 2.77x, Data Transfer up 5.37x.

Key Changes

  • Added ingest to the negative lookahead regex in the middleware matcher
  • PostHog analytics traffic (/ingest/s/, /ingest/i/v0/e/, /ingest/flags/, etc.) now bypasses middleware entirely
  • ~80% of middleware invocations were /ingest/* requests that called getTenants() only to pass through with no action

How to test

  • Deploy to preview and confirm PostHog analytics still works (events, session recording, feature flags)
  • Run vercel logs <deployment-url> and confirm /ingest/* paths no longer appear
  • Monitor Vercel usage dashboard for reduction in edge requests and function invocations

@rchlfryn rchlfryn self-assigned this Feb 18, 2026
@rchlfryn rchlfryn marked this pull request as ready for review February 18, 2026 18:32
@rchlfryn rchlfryn requested a review from yuliadub February 18, 2026 18:32
@github-actions
Copy link
Copy Markdown
Contributor

Preview deployment: https://exclude-post-hog-events.preview.avy-fx.org

Copy link
Copy Markdown
Contributor

@yuliadub yuliadub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I dont have all the context on all the pieces at play, but after doing some reading this makes sense to me!

@rchlfryn rchlfryn added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit 33dbc5c Feb 18, 2026
9 checks passed
@rchlfryn rchlfryn deleted the exclude-post-hog-events branch February 18, 2026 19:48
@github-actions
Copy link
Copy Markdown
Contributor

🚀 This is included in version v1.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants