Doing a res.redirect() in the API adds a '#' to the end of the URL
See original GitHub issueBug report
Describe the bug
In an API route, doing a res.redirect(302, '/somepath')
always adds a # to the end of the URL. For example:
res.redirect(302, '/allocation')
becomes: /allocation#
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Create an API route and do a res.redirect()
within the function.
Expected behavior
I expect the URL to not contain a ‘#’ sign.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: Mac OS Big Sur
- Browser: Chrome
- Version of Next.js: 10.0.3
- Version of Node.js: node:14.15.0-alpine
- Deployment: next
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Express.js res.redirect() Function - GeeksforGeeks
The res.redirect() function redirects to the URL derived from the specified path, with specified status, a integer (positive) which ...
Read more >Redirects With Express - Mastering JS
The res.redirect() function lets you redirect the user to a different URL by sending an HTTP response with status 302.
Read more >How to redirect user's browser URL to a different page in ...
You can use res.render() or res.redirect() method to redirect to another page using ... var navigator = require('web-midi-api'); var app = express(); ...
Read more >res.redirect() - Sails.js
return res.redirect(url);. Or: return res.redirect(statusCode, url);. Arguments. # ...
Read more >Creating Redirects With Nuxt - Josh Deltener
In this post we'll explore different ways of making redirects in your Nuxt application. ... writeHead(301, { location }) res.end() } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @nodeworks. I wasn’t able to reproduce 🤔 I tried redirecting to both a page and another api route:
and
Is there any other info that might help track this down?
Sure, not success guaranteed, but I’d like to look and see if I can help. I’ll send an email.