Node.js 将用户下载请求重定向到完全不同的服务器

Node.js 将用户下载请求重定向到完全不同的服务器,node.js,google-cloud-platform,get,webserver,Node.js,Google Cloud Platform,Get,Webserver,假设我想在GCP上存储用户文件,但我的网站是在AWS上托管的 当用户访问https://www.example.com/some_file要开始GCP上存在的下载吗 这将如何实现?通过我的NodeJS应用程序中的快速路线 是否会保留原始url 这里的最佳选项是什么?只需使用适当的状态代码和位置标题重定向它们 HTTP/1.1 302 Found Location: https://gcp.example.com/somewhere-else 如果您使用的是express,则存在一种方便的方法:

假设我想在GCP上存储用户文件,但我的网站是在AWS上托管的

当用户访问
https://www.example.com/some_file
要开始GCP上存在的下载吗

这将如何实现?通过我的NodeJS应用程序中的快速路线

是否会保留原始url


这里的最佳选项是什么?

只需使用适当的状态代码和
位置
标题重定向它们

HTTP/1.1 302 Found
Location: https://gcp.example.com/somewhere-else
如果您使用的是express,则存在一种方便的方法:

res.redirect(301, 'https://gcp.example.com/somewhere-else')

只需使用适当的状态代码和
位置
标题重定向它们

HTTP/1.1 302 Found
Location: https://gcp.example.com/somewhere-else
如果您使用的是express,则存在一种方便的方法:

res.redirect(301, 'https://gcp.example.com/somewhere-else')