Google Cloud Storage 中充当“重定向"的对象.或“符号链接" [英] An object in Google Cloud Storage which acts as a "redirect" or "symlink"

查看:23
本文介绍了Google Cloud Storage 中充当“重定向"的对象.或“符号链接"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望将现有网站移至 Google Cloud Storage.但是,该现有网站过去曾多次更改其 URL 结构.这些更改当前由 Apache 处理:例如,URL/days/000233.html 重定向到/days/new-post-name 和/days/new-post-name 重定向到/days/2002/01/01/new-职位名称.同样,/index.rss 重定向到/feed.xml,依此类推.

I'm looking to move an existing website to Google Cloud Storage. However, that existing website has changed its URL structure a few times in the past. These changes are currently handled by Apache: for example, the URL /days/000233.html redirects to /days/new-post-name and /days/new-post-name redirects to /days/2002/01/01/new-post-name. Similarly, /index.rss redirects to /feed.xml, and so on.

有没有办法在 GCS 中标记一个对象,以便它充当同一个存储桶中另一个 GCS 对象的符号链接"?也就是说,当我将网站配置添加到存储桶时,请求一个对象(理想情况下)会生成一个 301 重定向标头到另一个对象,或者(不太理想)将另一个对象的内容作为自己的内容提供?

Is there a way of marking an object in GCS so that it acts as a "symlink" to another GCS object in the same bucket? That is, when I add website configuration to a bucket, requesting an object (ideally) generates a 301 redirect header to a different object, or (less ideally) serves the content of the other object as its own?

我不想简单地在每个 URL 上复制对象,因为这会使我的存储空间增加三倍.我也不能在对象内容中使用元刷新标头,因为某些重定向对象不是 HTML 文档(它们是图像或 RSS 提要).出于类似的原因,我无法使用 JavaScript 在 NotFound 404.html 中处理此问题.

I don't want to simply duplicate the object at each URL, because that would triple my storage space. I also can't use meta refresh headers inside the object content, because some of the redirected objects are not HTML documents (they are images, or RSS feeds). For similar reasons, I can't handle this inside the NotFound 404.html with JavaScript.

推荐答案

很遗憾,Google Cloud Storage 目前不支持符号链接功能.不过,这是一个好主意,值得考虑作为未来的功能.

Unfortunately, symlink functionality is currently not supported by Google Cloud Storage. It's a good idea though and worth considering as a future feature.

这篇关于Google Cloud Storage 中充当“重定向"的对象.或“符号链接"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆