通过nodejs重定向到URL
我试图接收请求并将用户重定向到另一个URL 但是URL无法更改
const success_url = 'https://site.online/success'
const query = '?order_id=123123&data=abc'
res.status(301).redirect(`${success_url}${query}`);
// the output must be https://site.online/success?order_id=123123&data=abc
// but i get http://localhost:3000/success?order_id=123123&data=abc
also tried res.redirect(301, `${success_url}${query}`);
我如何更改本地主机:3000到目标URL的域
i tried to receive get request and redirect the user to another url
but the url not changing
const success_url = 'https://site.online/success'
const query = '?order_id=123123&data=abc'
res.status(301).redirect(`${success_url}${query}`);
// the output must be https://site.online/success?order_id=123123&data=abc
// but i get http://localhost:3000/success?order_id=123123&data=abc
also tried res.redirect(301, `${success_url}${query}`);
How i can change localhost:3000 to the domain of the target url
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用。redirect(code,url)。
You want to use .redirect(code, url).