N
Nuxt6mo ago
Thiimo

issue for nuxt proxy with Posthog

So I've been trying to get a reverse proxy setup for my analytics, but I keep getting this error:
{
"url": "/ingest/i/v0/e/?_=1717162970946&compression=gzip-js&ip=1&retry_count=1&ver=1.136.2",
"statusCode": 500,
"statusMessage": "",
"message": "fetch failed",
"stack": ""
}
{
"url": "/ingest/i/v0/e/?_=1717162970946&compression=gzip-js&ip=1&retry_count=1&ver=1.136.2",
"statusCode": 500,
"statusMessage": "",
"message": "fetch failed",
"stack": ""
}
I have a posthog.client.ts plugin with the following content
export default defineNuxtPlugin(() => {
const runtimeConfig = useRuntimeConfig()
const posthogClient = posthog.init(runtimeConfig.public.posthogPublicKey, {
api_host: '/ingest',
ui_host: 'https://eu.posthog.com',
capture_pageview: false,
loaded: (posthog) => {
if (import.meta.env.MODE === 'development')
posthog.debug()
},
})
})
export default defineNuxtPlugin(() => {
const runtimeConfig = useRuntimeConfig()
const posthogClient = posthog.init(runtimeConfig.public.posthogPublicKey, {
api_host: '/ingest',
ui_host: 'https://eu.posthog.com',
capture_pageview: false,
loaded: (posthog) => {
if (import.meta.env.MODE === 'development')
posthog.debug()
},
})
})
and in my nuxt.config.ts I have the following route rules:
export default defineNuxtConfig({
routeRules: {
'/ingest/static/**': {
proxy: 'https://eu-assets.i.posthog.com/static/**',
},
'/ingest/**': {
proxy: 'https://eu.i.posthog.com/**',
},
},
})
export default defineNuxtConfig({
routeRules: {
'/ingest/static/**': {
proxy: 'https://eu-assets.i.posthog.com/static/**',
},
'/ingest/**': {
proxy: 'https://eu.i.posthog.com/**',
},
},
})
1 Reply
Thiimo
ThiimoOP6mo ago
Seems like an issue with Netlify, if anyone has any ideas please let me know!
Want results from more Discord servers?
Add your server