Improved proxy config
Some checks are pending
Runs E2E API Tests / build (20.x) (push) Waiting to run
Lint & build / lint_and_build (18.x) (push) Waiting to run
Lint & build / lint_and_build (20.x) (push) Waiting to run

This commit is contained in:
Stan Wohlwend 2024-07-27 11:45:33 -07:00
parent 0aa5b11b9e
commit 1128e59b6c
3 changed files with 22 additions and 7 deletions

View File

@ -26,6 +26,7 @@
"nicify",
"oidc",
"openapi",
"posthog",
"Proxied",
"reqs",
"stackframe",

View File

@ -70,6 +70,21 @@ const nextConfig = {
poweredByHeader: false,
async rewrites() {
return [
{
source: "/consume/static/:path*",
destination: "https://eu-assets.i.posthog.com/static/:path*",
},
{
source: "/consume/:path*",
destination: "https://eu.i.posthog.com/:path*",
},
];
},
skipTrailingSlashRedirect: true,
async headers() {
return [
{

View File

@ -5,12 +5,11 @@ import { PostHogProvider } from 'posthog-js/react';
import { Suspense, useEffect, useState } from 'react';
if (typeof window !== 'undefined') {
if (process.env.NEXT_PUBLIC_POSTHOG_KEY) {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
person_profiles: 'identified_only',
});
}
posthog.init("phc_vIUFi0HzHo7oV26OsaZbUASqxvs8qOmap1UBYAutU4k", {
api_host: "/consume",
ui_host: "https://eu.i.posthog.com",
person_profiles: 'identified_only',
});
}
export function CSPostHogProvider({ children }: { children: React.ReactNode }) {
return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
@ -37,4 +36,4 @@ function UserIdentityInner() {
}
}, [user, lastUserId]);
return null;
}
}