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 ws-info
with 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 tmp.mydomain.tld.website-us-east-1.linodeobjects.com
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.
14 Replies
Hey @sayajay - I was reading through the "Next Steps" portion of our static site guide, and it certainly looks like you're on the right track.
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.
@jdutton Same issue here.
I nailed it down to this not working when the request is proxied through CloudFlare (ie. when we leverage CloudFlare capabilities)
What can be done to use Linode object storage with CloudFlare?
Hey everyone. It looks like our Object Storage team is aware of the issues around using Cloudflare with our Object Storage.
In the meantime, there are some workarounds that were posted on another Community Question here: How can i setting cloudflare CNAME link Object Storage and use CDN
Specifically, your CNAME alias must match your bucket name. This would also require you to use the Linode DNS Manager to manage your CNAME DNS settings, rather than through Cloudflare.
@jdutton Do you have any recommended CDN service to integrate Linode's object storage static site?
Any update on this issue? I moved my domain from Cloudflare back to Namecheap and the issue still persists.
BUMP!
I'm having the EXACT same issue as described in all the post here. I've been struggling (wasting days of time) thinking that I was experiencing a problem with one of the following:
1) Hugo itself (my static site is a Hugo static website)
2) The s3cmd (I moved to other s3 cli tools including s3deploy and s4cmd), thinking it was an acl/permission issue
3) Reviewed the CORS setting on the Linode Bucket
4) Uploaded, deleted, re-uploaded all website files
5) Used s3cmd to create (ws-create), delete (ws-delete), check (ws-info), lather-rinse-repeat at least a dozen times
6) Searched high and low on the internet to figure out if this is a DNS, Cloudflare or Linode issue and finally, came across this community thread.
Could someone please let me know if they've had any luck resolving this issue?
What I was trying to do was: Linode Bucket/S3 <- Cloudflare CNAME
. The thing that has been driving me up the wall is that Cloudflare is indeed able to requests directly to files, just not "implicit" requests for either and "index.html" or "404.html" file.
To further clarify, as with all other posts above, I too am able to confirm that "ws-create" functions because my bucket's index.html files are automatically served whenever a url ending in slash "/" is requested, when loading the site directly from the bucket's "[bucket-id].website-[cluster-id].linodeobjects.com" url - i.e. https://www.mydomain.net.website-us-ord-1.linodeobjects.com/ and https://www.mydomain.net.website-us-ord-1.linodeobjects.com/about/ work perfectly. On the other hand, https://www.mydomain.net/ and https://www.mydomain.net/about/ do not work, they serve that dreaded "XML of death" (lol) file.
In my case, I'd have loved to do everything directly from within Linode's platform but (and please share info if I'm missing it albeit, this thread says otherwise), I don't think Linode is able to do "CNAME flattening" like Cloudflare does… yet (at time of writing this post). I need CNAME flattening because the project I'm working on is a simple portfolio project that will not have ANY A records associated with it. I.e. on Cloudflare, this is what I expected to be able to do (apologies, I'm still something of a newbie vis DNS Zone notation - please bear with me):
- @ (root / apex domain) = CNAME www.mydomain.net
- www = CNAME www.mydomain.net.website-us-ord-1.linodeobjects.com
Thus, my root/apex domain would be configured to point to the "www" subdomain like so: mydomain.net -> www.mydomain.net
and the "www" domain would point to the S3-Website Bucket on Linode Object Storage like so: www.mydomain.net -> www.mydomain.net.website-us-ord-1.linodeobjects.com
. All of this config is done but XML files (listing the contents of the directory) are being served instead of the index.html
file within them.
You know though, after all this hassle, I find that I really wish I'd simply have gone straight to setting up a micro-instance server as the website's files are less than 500mb total and expected bandwidth is less than 10gb/month… I truly though I'd save days of time by going the S3-static website route (i.e. hours worth of setup and future server maintenance, monitoring and security hardening)… lol, life and it's ridiculous snarls right?!
Side note: the post just before mine (from 2 years ago) asks about pointing a custom domain's root/apex to the Linode Object Store Bucket domain - from what I can tell, I also haven't come across any articles saying Lindoes provides this capability (as this article state) that indicate that Linode is capable (out of the box in the Cloud Manager UI) to enable CDN capabilities (esp. for website buckets). To answer @lxsedov's question, you'd need to use a DNS manager that offers "CNAME flattening" which Linode's DNS manager doesn't do but Cloudflare's does.
All told, lacking any other info, I think I'm gonna have to move to AWS or Cloudflare's bucket solution.
I really wish I'd have learned about this incapability on Linode before spending so many days (3 total including two all-nighters) wrestling with Linode as my static website S3 bucket provider.
Fingers still crossed that someone has a solution though! If nothing else, I hope that Linode is able to become the vendor of choice for this sorta setup in the future because I truly admire the team and org as a whole!!
Similar just experienced.
https://bucket.website-cluster.linodeobjects.com/ loads index and 404 fine.
https://mydomain.tld I get XML 'nosuchbucket'
Cloudflare CNAME entry for mydomain.tld
Bit stuck :)
I have to admit, I'm not an expert when it comes to Object Storage Buckets, CNAME records/flattening, and Cloudflare. However there is this post titled How can i setting cloudflare CNAME link Object Storage and use CDN that I believe addresses your issue. There, we say:
"I've confirmed that CNAME flattening, and Apex (root) domains, such as example.tld, are not supported at this time, whether through Linode's DNS, or a CDN. Our Technical Content team will be updating our documentation here:
https://www.linode.com/docs/products/storage/object-storage/guides/custom-domain"
As you can see from this thread and the other one, this is a feature that many people would like to see added to our platform. I've gone ahead and included your requests to tracking for this as well.