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

343
Vistas
Next.js api read after '#' in request.url

I am trying to read a GET request url that has the query strings after a '#' (out of my control) e.g:

http://...onnect/endpoint/#var_name=var_value...

request.url does not show anything after endpoint/

The problem can be dealt with if the endpoint renders html then i use javascript to get the query string, but that is what I am avoiding - is there a way to get the query string from the request.url or other request.[parameter] ?

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

0

On the server you will never get the part that starts with #. But on the client side you can get it with window.location.hash.

What you can do if this is in your control, is to extract it from client side then send it to the server in some other way

about 4 years ago · Juan Pablo Isaza Denunciar

0

I was able to create a workaround (avoiding the need to create a Next.js page)

I created a redirect page using res.writeHead and res.write

res.writeHead(302, { 'Content-Type': 'text/html' })
res.write(`
    <script>
        const queryString = window.location.hash.replace('#', '')
        window.location.href='http://...onnect/endpoint?'+ queryString 
    </script>
`)
res.end()

Please if you have anything better feel free to answer.

Thank you.

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