Skip to content

Commit

Permalink
fix: posthog rewrite (#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored Sep 12, 2024
1 parent 66103cf commit 57ade6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ui/docs-bundle/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NextRequest, NextResponse, type MiddlewareConfig, type NextMiddleware }
import urlJoin from "url-join";
import { extractBuildId, extractNextDataPathname } from "./utils/extractNextDataPathname";
import { getPageRoute, getPageRouteMatch, getPageRoutePath } from "./utils/pageRoutes";
import { rewritePosthog } from "./utils/rewritePosthog";
import { getXFernHostEdge } from "./utils/xFernHost";

const API_FERN_DOCS_PATTERN = /^(?!\/api\/fern-docs\/).*(\/api\/fern-docs\/)/;
Expand Down Expand Up @@ -41,7 +42,7 @@ export const middleware: NextMiddleware = async (request) => {
* Rewrite Posthog analytics ingestion
*/
if (nextUrl.pathname.includes("/api/fern-docs/analytics/posthog")) {
return NextResponse.rewrite(nextUrl, { request: { headers } });
return rewritePosthog(request);
}

/**
Expand Down

0 comments on commit 57ade6f

Please sign in to comment.