Skip to content

Commit c62fe41

Browse files
authored
Remove unused env var and reorder rewrites (#1069)
<!-- PR title format: type(scope): description — e.g., feat(auth): add SSO login --> <!-- Keep the title under 72 characters, use imperative mood, no trailing period. --> ## Summary The PostHog reverse-proxy catch-all rewrite (/ingest/:path*) was ordered before the more specific /ingest/decide and /ingest/static/:path* rewrites, causing it to swallow those routes. This moves the catch-all to after the specific rewrites so they match first. Also removes the unused NEXT_PUBLIC_POSTHOG_HOST env var from .env. ## Verification - Confirmed rewrite order in next.config.mjs places /ingest/static/:path* and /ingest/decide before the catch-all /ingest/:path* - No build errors introduced ## Reviewer Notes Next.js rewrites are evaluated top-down and first-match wins. The catch-all was previously shadowing the specific routes. A comment is added inline to prevent future reordering.
2 parents 9c0cd61 + fbcf719 commit c62fe41

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ DEBUG_AUTH=
44
STRIPE_TOP_UP_PRICE_ID=price_1RjLOnJ7A6SsvrfSlQLRoy7x
55

66
# posthog - not secret, not really useful for most dev, but _not_ loading it would increase the diff with prod.
7-
NEXT_PUBLIC_POSTHOG_HOST="https://us.i.posthog.com"
87
NEXT_PUBLIC_POSTHOG_KEY=phc_GK2Pxl0HPj5ZPfwhLRjXrtdz8eD7e9MKnXiFrOqnB6z
98

109
# Database

next.config.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,20 @@ const nextConfig = {
5050
source: '/config.json',
5151
destination: 'https://opencode.ai/config.json',
5252
},
53+
// PostHog reverse proxy rewrites — specific routes MUST come before the catch-all
5354
{
5455
source: '/ingest/static/:path*',
5556
destination: 'https://us-assets.i.posthog.com/static/:path*',
5657
},
57-
{
58-
source: '/ingest/:path*',
59-
destination: 'https://us.i.posthog.com/:path*',
60-
},
6158
{
6259
source: '/ingest/decide',
6360
destination: 'https://us.i.posthog.com/decide',
6461
},
62+
// Catch-all must be last — otherwise it swallows /decide and /static
63+
{
64+
source: '/ingest/:path*',
65+
destination: 'https://us.i.posthog.com/:path*',
66+
},
6567
{
6668
source: '/.well-known/appspecific/com.chrome.devtools.json',
6769
destination: '/api/chrome-devtools',

0 commit comments

Comments
 (0)