Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
Nextjs app with proxy - headers not included in response

I'm proxying requests to an external backend from a Nextjs app and trying to extract an Authorization header from the response using the native fetch library. However the headers in the fetch response are empty even though they are present in the actual response from the server.

Here's the setup in the next.config.js file:

module.exports = {
  async headers() {
    return [
      {
        source: '/api/:path*',
        headers: [
          {
            key: 'Access-Control-Expose-Headers',
            value: '*, authorization',
          },
        ],
      },
    ]
  },
  async rewrites() {
    return [
      {
        source: '/api/:path*',
        destination: `${process.env.NEXT_PUBLIC_BASE_URL}/api/:path*`,
      },
    ]
  },
}

With my limited knowledge of proxies I'm assuming that it's a reverse proxy and the headers are lost in the response back somewhere inside it. I've also tried adding a middleware to try to localize where the headers are being lost without any luck.

Does anyone know where I can configure the headers to be included back from the proxy?

Thanks in advance! :)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I am reusing a fetcher from react-native and it seems like the method for extracting headers differs. 😅

This works using fetch in the browser: response.headers.get('authorization')

In react-native: response.headers.map['authorization']

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda