[英]Redirect on a different location and port in node.js
要将用户重定向到其他页面,我们通常会这样做:
res.writeHead(302, {
Location: '/test'
});
res.end();
如果我想将他重定向到另一个端口怎么办? 我试图添加一个字段'端口',但它似乎不起作用。
您需要指定完整的URL:
res.writeHead(302, {
Location: 'http://anotherdomain.com:8888/some/path'
});
res.end();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.