Default documents in subfolders of static sites with object storage

I have set up a static site in an object storage bucket following the documentation here. As expected,

s3cmd ws-create --ws-index=index.html --ws-error=404.html s3://my-bucket

means that the two urls

give me effectively the same page. But this does not seem to work reliably for subfolders. For instance, <img src='_images/image.png'/> is rendered correctly in

but not in

In what I'm assuming is a related issue, a static html site generator I use produces index.html files with a line

<meta http-equiv="refresh" content="0; URL='some_other_url.html'">

In this case, navigating to

sends me to

rather than the expected

Is there any way to avoid this behavior?

2 Replies

For the first part of your question, dealing with viewing images subfolders, this is likely a permissions issue. When you initialize a static site, you set the Access Controls to "public". Anything you upload after that is "private" by default, and therefore cannot be accessed over freely over the internet.

In order to change this, you'll need to change the ACL policy to "public" using either s3cmd or the Cloud Manager.

In the case of your HTML redirect, I wonder if reconfiguring that line to the following would resolve your issue:

<meta http-equiv="refresh" content="0; URL='subfolder2/some_other_url.html'">

You could then set the ACL policy to ensure those files are accessible publicly.

Many thanks for your response, @tlambert, and sorry for my slow reply. I can confirm that this is not a permissions issue.

Editing all paths so that they are relative to the root of my site does indeed fix things. But I didn't have to do this with any of my four previous hosting providers. There are many of these subfolders that I need to periodically move/rename, and I'd like to avoid having to edit-replace all of the paths each time.

In case it is useful, here is a more minimal example. Suppose I have a subfolder test

├── index.html
└── target.html

where index.html contains the link

<a href="target.html">link</a>

with a relative path. If I navigate to

and click on the link, everything works as expected. If, however, I navigate to

and click on the same link, I get an error page with 404 Not Found; Code: NoSuchKey. With my previous hosting providers (not based on object storage), the link works in both cases.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct