Skip to content

Commit 3c799c0

Browse files
committed
Fix: prevent redirects
1 parent 4eb0895 commit 3c799c0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/web/next.config.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ const nextConfig = {
5252
},
5353
{ source: '/ingest/:path*', destination: 'https://us.i.posthog.com/:path*' },
5454
{ source: '/ingest/decide', destination: 'https://us.i.posthog.com/decide' },
55+
// Rewrite API routes with trailing slash to without trailing slash to prevent redirects
56+
{
57+
source: '/api/:path*/',
58+
destination: '/api/:path*',
59+
},
5560
];
5661
},
5762
...(isStaticExport === 'true' && { output: 'export' }),
@@ -89,9 +94,7 @@ const getPostHogProjectName = () => {
8994
return 'Normal_Development';
9095
}
9196

92-
return (
93-
posthogConfig.projectName || (network === 'mainnet' ? 'Normal_Mainnet' : 'Normal_Testnet')
94-
);
97+
return posthogConfig.projectName || (network === 'mainnet' ? 'Normal_Mainnet' : 'Normal_Testnet');
9598
};
9699

97100
const posthogOptions = {

0 commit comments

Comments
 (0)