-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnext.config.ts
46 lines (42 loc) · 1.09 KB
/
next.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
port: "",
pathname: "/**",
},
],
},
async rewrites() {
const postHogBaseURL = process.env.NEXT_PUBLIC_POSTHOG_HOST;
if (!postHogBaseURL) {
return [];
}
const assetPath =
postHogBaseURL === "https://us.i.posthog.com"
? "https://us-assets.i.posthog.com"
: postHogBaseURL === "https://eu.i.posthog.com"
? "https://eu-assets.i.posthog.com"
: process.env.NEXT_PUBLIC_POSTHOG_ASSET_HOST || "";
return [
{
source: "/ingest/static/:path*",
destination: assetPath + "/static/:path*",
},
{
source: "/ingest/:path*",
destination: postHogBaseURL + "/:path*",
},
{
source: "/ingest/decide",
destination: postHogBaseURL + "/decide",
},
];
},
// This is required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
};
export default nextConfig;