-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the problem
I want to use PostHog, an open source analytics platform.
But request to their server from the browser can be blocked for CORS reasons or blocked by ad-blockers.
A reverse proxy would enable me to send its events through an endpoint in my own website.
https://posthog.com/docs/advanced/proxy/nextjs
I am blocked for this use case because Vercel, the host that I use, do not support middlewares for SvelteKit, see
https://stackoverflow.com/questions/76937328/sveltekit-server-side-rewrites
https://vercel.com/docs/frameworks/sveltekit#server-side-rendering
"While server-side rendered SvelteKit apps do support middleware, SvelteKit does not support URL rewrites from middleware."
https://posthog.com/docs/advanced/proxy/vercel
I do not want to stop using vercel because they are very practical and Sentry, another lib that I use, does not support Cloudflare ATM.
I did not manage to make a tunneling endpoint because the posthog sdk sends streams of data, so If I read the stream and send the request I change the request from a stream to something else and their API endpoint seems to not support it
Describe the proposed solution
A middleware enabling rewrites like the one from Next.js
Alternatives considered
See problem description
Importance
would make my life easier
Additional Information
No response