Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

349
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!