PostHog / posthog

🦔 PostHog provides open-source web & product analytics, session recording, feature flagging and A/B testing that you can self-host. Get started - free.
https://posthog.com
Other
22.05k stars 1.33k forks source link

Site apps/widgets don't work when proxying #25963

Open elie222 opened 2 weeks ago

elie222 commented 2 weeks ago

Bug Description

I'm trying to use the widget for early access. It works locally but doesn't run when running in production. I believe it's because I'm proxying PostHog via our own backend:

  posthog.init(env.NEXT_PUBLIC_POSTHOG_KEY, {
    api_host: env.NEXT_PUBLIC_POSTHOG_API_HOST,
    capture_pageview: false,
    opt_in_site_apps: true,
  });

Tried adding a redirect header for this but didn't work either:

async rewrites() {
    return [
      {
        source: "/ingest/:path*",
        destination: "https://app.posthog.com/:path*",
      },
      // added redirect to try solve this issue but didn't work
      {
        source: "/site_app/:path*",
        destination: "https://app.posthog.com/site_app/:path*",
      },
    ];
  },

Debug info

No response

medicmilos commented 20 hours ago

Hey @elie222 have you been able to resolve issue?

elie222 commented 5 hours ago

Hey @elie222 have you been able to resolve issue?

I just built the component myself instead of using the prebuilt one.