From 6af384fb4066639ee909ba3559e82cac954c1d9f Mon Sep 17 00:00:00 2001 From: timgl Date: Thu, 11 Jan 2024 16:13:33 +0000 Subject: [PATCH] fix: Don't allow us.posthog.com to be used (#957) --- src/posthog-core.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 1d4e1bcb7..07efdd15f 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -1738,6 +1738,11 @@ export class PostHog { // We assume the api_host is without a trailing slash in most places throughout the codebase this.config.api_host = this.config.api_host.replace(/\/$/, '') + + // us.posthog.com is only for the web app, so we don't allow that to be used as a capture endpoint + if (this.config.api_host === 'https://us.posthog.com') { + this.config.api_host = 'https://app.posthog.com' + } this.persistence?.update_config(this.config) this.sessionPersistence?.update_config(this.config)