Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Use next rewrites for API_URL.
Mike Caof985b4f9a559
diff --git a/next.config.ts b/next.config.tsindex 922d128bd..879b2d857 100644--- a/next.config.ts+++ b/next.config.ts@@ -123,6 +123,7 @@ if (isProd) {}const rewrites = [];+const beforeFilesRewrites = [];if (trackerScriptURL) {rewrites.push({@@ -157,6 +158,11 @@ if (isRelativeUrl(apiUrl)) {destination: '/api/:path*',});}+} else if (apiUrl) {+ beforeFilesRewrites.push({+ source: '/api/:path((?!auth(?:/|$)|config(?:/|$)).*)',+ destination: `${apiUrl.replace(/\/+$/, '')}/:path`,+ });}const redirects = [@@ -244,17 +250,20 @@ export default withNextIntl({return headers;},async rewrites() {- return [- ...rewrites,- {- source: '/telemetry.js',- destination: '/api/scripts/telemetry',- },- {- source: '/teams/:teamId/:path*',- destination: '/:path*',- },- ];+ return {+ beforeFiles: beforeFilesRewrites,+ afterFiles: [+ ...rewrites,+ {+ source: '/telemetry.js',+ destination: '/api/scripts/telemetry',+ },+ {+ source: '/teams/:teamId/:path*',+ destination: '/:path*',+ },+ ],+ };},async redirects() {return [...redirects];diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex ed0e7f952..5c65e466d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -334,6 +334,8 @@ importers:specifier: ^4.1.6version: 4.1.6(@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ dist: {}+packages:'@adobe/[email protected]':