Skip to content

Commit

Permalink
chore: use reverse proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7u committed Mar 14, 2024
1 parent e75715c commit 97d1b25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 11 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@ const baseConfig = nextTranslate({
source: `${prefix}/native-staking`,
})),
],
rewrites: async () =>
["/rss", "/rss/"].map((path) => ({
rewrites: async () => [
...["/rss", "/rss/"].map((path) => ({
destination: "/rss.xml",
source: path,
})),
{
destination: "https://eu-assets.i.posthog.com/static/:path*",
source: "/ingest/static/:path*",
},
{
destination: "https://eu.i.posthog.com/:path*",
source: "/ingest/:path*",
},
],
typescript: {
ignoreBuildErrors: process.env.QUICK_BUILD === "true",
},
Expand Down
9 changes: 6 additions & 3 deletions src/screens/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
// Check that PostHog is client-side (used to handle Next.js SSR)
if (typeof window !== "undefined") {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY as string, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
api_host: `${window.location.origin}/ingest`,

// Enable debug mode in development
loaded: (posthog) => {
if (process.env.NODE_ENV === "development") posthog.debug();
loaded: (_posthog) => {
if (process.env.NODE_ENV === "development") _posthog.debug();
},

ui_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
});
}

Expand Down Expand Up @@ -59,6 +61,7 @@ export default function MyApp({
return () => {
router.events.off("routeChangeComplete", handleRouteChange);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down

0 comments on commit 97d1b25

Please sign in to comment.