Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(flags): redirect hyphenated /feature-flags to underscore route (#71068)

posthog[bot]721191f94e2e
diff --git a/frontend/src/scenes/sceneLogic.test.tsx b/frontend/src/scenes/sceneLogic.test.tsx
index 274cbf4ff12a..cb96f0fa369a 100644
--- a/frontend/src/scenes/sceneLogic.test.tsx
+++ b/frontend/src/scenes/sceneLogic.test.tsx
@@ -70,6 +70,16 @@ describe('sceneLogic', () => {
})
})
+ it('redirects the hyphenated /feature-flags path to the underscore scene route', async () => {
+ router.actions.push('/feature-flags')
+ await expectLogic(logic).delay(1)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.featureFlags())
+
+ router.actions.push('/feature-flags/123')
+ await expectLogic(logic).delay(1)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.featureFlag('123'))
+ })
+
it('persists the loaded scenes', async () => {
const expectedAnnotation = partial({
component: expect.any(Function),
diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts
index df2b940b973e..cbfa0fa2c601 100644
--- a/frontend/src/scenes/scenes.ts
+++ b/frontend/src/scenes/scenes.ts
@@ -699,6 +699,9 @@ export const redirects: Record<
'/events/properties/:id': ({ id }) => urls.propertyDefinition(id),
'/events/stats': urls.eventDefinitions(),
'/events/stats/:id': ({ id }) => urls.eventDefinition(id),
+ // The scene lives at /feature_flags (underscore); catch the hyphenated variant so it doesn't 404
+ '/feature-flags': urls.featureFlags(),
+ '/feature-flags/:id': ({ id }) => urls.featureFlag(id),
'/i/:shortId': ({ shortId }) => urls.insightView(shortId),
'/instance': urls.instanceStatus(),
'/me/settings': urls.settings('user'),