如何转发到Node.js中的新URL并强制更改浏览器URL?

时间:2018-08-22 03:43:47

标签: node.js url redirect browser

我正在尝试使用以下代码将Node.js GET请求中的URL重定向到本地运行的服务(https://localhost:8888/test?forwarding=true)上的端点:

if (forwarding){
    res.redirect("https://google.com");
}

但是,转发的页面无法正确加载资源:

enter image description here

这似乎是因为URL保持为https://localhost:8888/test?forwarding=true,并且现在所有相对路径都被破坏了。

如何强制浏览器实际上重定向到 https://google.com ,并且地址栏中的URL相应更改?

0 个答案:

没有答案
相关问题