object storage static site not serving index.html when accessed via external domain
I created a bucket with the intent of serving a static website. Using
s3cmd, everything looks good. My bucket is named
tmp.mydomain.tld, and I am pointing a subdomain to it.
When I visit the site via the default URL, it works great
I created a CNAME record in my DNS manager to point to my bucket url:
tmp.mydomain.told points to
However, when I visit http://tmp.mydomain.tld, instead of the contents of
index.html, I see an XML document that lists my bucket contents.
Is there something in this setup that I'm missing?
Some other details, which may be relevant:
- my DNS is managed by Cloudflare. I currently have the proxy turned on, but I have switched to DNS-only passthrough mode. Same problem.
Based on the URLs you provided vs. the URLs I'm seeing on my own buckets, I'm not seeing the
website- portion of
tmp.mydomain.tld.website-us-east-1.linodeobjects.com. I'm not sure if this was just an example, but I would try copying/pasting the exact URL of your bucket into the CNAME record (if you haven't done it already).
It's also worth checking to make sure the CNAME hostname includes the subdomain portion of your bucket name. For example, if your bucket is named
tmp.mydomain.tld, the hostname portion of the CNAME record should read the same. It looks like you may have already done this, but I thought I'd mention it just in case.
If you happen to get things working, please post your solution in case anyone else runs into the same thing. I'm curious myself!
I'm seeing this exact same issue. Requests to
www.mydomain.tld.website-us-east-1.linodeobjects.com respect both the Index and Error document settings, but requests via the
www.mydomain.tld CNAME do not. Additionally, my testing shows the
website- portion is required for those settings to be respected as well.
I'm guessing that whatever is serving the content out of the buckets is looking for a
Host header matching
*.website-us-east-1.linodeobjects.com. For what it's worth, AWS gets around this by requiring that the bucket name must match the (sub)domain name, presumably so they can also match the
Host header against bucket names as well.
I realized my last post may not have been super clear. So just to be clear: accessing objects works using all the mentioned domain names. What does not work is the implicit index and 404 pages using anything except the
website- domain name.
@jdutton I have the same issue using a Cloudflare CNAME in front of Object Storage.
https://mybucket.com.website-us-east-1.linodeobjects.com loads index.html as expected, and
https://mybucket.com/index.html works, but
https://mybucket.com loads the bucket listing XML instead of index.html. I'll have to find a different hosting provider if I can't get this solved soon.
I found that Cloudflare has their own object storage now (https://www.cloudflare.com/products/workers-kv/). I moved over there and was up and running quickly for the same $5/mo price.