How to access nuxt3 request headers?

96 Views Asked by At

I am having a plugin in nuxt3, which is basically the posthog example integration, and it works. What I would like to do is to send a custom header through a chrome extension ModHeader which I name Posthog-User to add my name. Any request from my side I can not filter in posthog. Issue is, I don't find a way how to take that header I submit when requesting nuxt pages.

Any suggestions on how to use it in a nuxt 3 plugin? This I have tried:

export default defineNuxtPlugin(nuxtApp => {
  useRequestEvent() // only works ssr as far as I understand
  useRequestHeaders() // only works ssr as far as I understand

  // headers("Posthog-User") -> NAME
  // so I can pass that into the posthog config.
})
0

There are 0 best solutions below