我正在尝试以这种方式重定向node.js中我的应用程序的url:
// response comes from the http server
response.statusCode = 302;
response.setHeader("Location", "/page");
response.end();
Run Code Online (Sandbox Code Playgroud)
但是当前的页面与新的页面混合在一起,看起来很奇怪:| 我的解决方案看起来完全合乎逻辑,我不知道为什么会发生这种情况,但如果我在重定向后重新加载页面就可以了.
无论如何,在节点中进行HTTP重定向的正确方法是什么?