是否可以在不添加index.html的情况下从Google云存储访问目录? [英] Is it possible to access directory from Google cloud storage without adding index.html?

查看:50
本文介绍了是否可以在不添加index.html的情况下从Google云存储访问目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Google Cloud Storage用作静态网站,并且 index.html 对象存储在我的存储桶子目录/文件夹中,例如 my-directory

只能在此位置访问 www.example.com/my-directory/index.html ,但我想以 www.example.com/my-directory/有可能吗?

我试图将MainPageSuffix添加为index.html,但是它仅在根级别有效.

解决方案

面向未来的读者:可能,但由于 解决方案

For future readers: It is possible, but due to a slight quirk hinted at here you may actually have an empty object named my-directory/ and an object named my-directory/index.html so when you try and view it in your browser you are hitting the empty object that is not publicly accessible named my-directory/.

It's possible to determine if you have an empty object by using gsutil:

gsutil ls -R gs://my-bucket/my-directory*

You should see an output similar to this if you have an empty object:

gs://my-bucket/my-directory/:
gs://my-bucket/my-directory/           <- This is the empty object
gs://my-bucket/my-directory/index.html

To resolve this you can use gsutil to delete the empty object without affecting your other objects in the directory:

gsutil rm gs://my-bucket/my-directory/

这篇关于是否可以在不添加index.html的情况下从Google云存储访问目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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