Documentación offline Nuxt main

useRequestFetch

main Documentación oficial Licencia MITDescargado el 2026-08-02

You can use useRequestFetch to forward the request context and headers when making server-side fetch requests.

When making a client-side fetch request, the browser automatically sends the necessary headers. However, when making a request during server-side rendering, due to security considerations, we need to forward the headers manually.

::note Headers that are not meant to be forwarded will not be included in the request. These headers include, for example: transfer-encoding, connection, keep-alive, upgrade, expect, host, accept ::

::tip The useFetch composable uses useRequestFetch under the hood to automatically forward the request context and headers. ::

::code-group

```vue [app/pages/index.vue]

```ts [server/api/cookies.ts]
export default defineEventHandler((event) => {
  const cookies = parseCookies(event)

  return { cookies }
})

::

::tip In the browser during client-side navigation, useRequestFetch will behave just like regular $fetch. ::