Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

345
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda