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

查看:55
本文介绍了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 -post-name.同样,/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 feed).出于类似的原因,我无法在带有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天全站免登陆