R2.dev subdomain has been set to 'allow' status. But when open the link, it showed Error 404.

"Error 404 This object could not be viewed You are not authorized to view this object This object does not exist or is not publicly accessible at this URL. Check the URL of the object that you're looking for or contact the owner to enable Public access." I have no idea what is going on here.
No description
22 Replies
Chaika
Chaika15mo ago
The keyword in that error is "This object does not exist or ...", you're just trying to access a non-existent object. If you're expecting a listing or something like that, there isn't one, you can only directly navigate to objects
Hanx
HanxOP15mo ago
Thanks Chaika, the object is the uploaded file right?
Chaika
Chaika15mo ago
(if your bucket was private/not publicily viewable, it would throw a 401 - this bucket cannot be viewed)
Hanx
HanxOP15mo ago
I have uploaded a file into the bucket
Chaika
Chaika15mo ago
If you uploaded something yea, you can see all your objects in the dashboard under R2
Hanx
HanxOP15mo ago
Yes, I do uploaded one file there. I can see it under the bucket
Chaika
Chaika15mo ago
Make sure you're not appending the bucket name to your path, it's just https://pub-<uuid>.r2.dev/<filename> If that's not it, what do you see in your bucket, and what's your r2.dev url?
Hanx
HanxOP15mo ago
https://pub-1b348e470bee4d38a8842b496808a871.r2.dev This is automatically generated by the system
Chaika
Chaika15mo ago
What do you see in your bucket listing in the dashboard (a screenshot would help)? It may be worth noting as well, by enabling public access, everything in your bucket will be accessible by URL. If there's anything private in there, you'd want some access control in front of it, either with a worker or something else
Hanx
HanxOP15mo ago
I have uploaded only 1 file for test.
Hanx
HanxOP15mo ago
No description
Chaika
Chaika15mo ago
You'd access it by https://pub-1b348e470bee4d38a8842b496808a871.r2.dev/somethingblurred%20Release(1).apk (of course, replacing somethingblurred with the actual filename)
Hanx
HanxOP15mo ago
Oh, thanks very much. Got it now. Can I ask for one more question?
Chaika
Chaika15mo ago
Sure Just one other thing I'd note: the r2.dev, as it says, is meant only for testing and not for production use cases. For production, use a custom domain of your own, which you can attach in the bucket settings With your own custom domain you can use cache rules/page rules to force cache as well, and any cache hit doesn't cost you a class b/any r2 costs
Hanx
HanxOP15mo ago
Yes, this is about the thing I wanna ask. I have added a custom domain. But it seems the same Error 404
Chaika
Chaika15mo ago
You can't get your file using the file name, in the same way as you can with the pub-r2.dev?
Hanx
HanxOP15mo ago
All right. It worked, so it is the same, I have to add the file name after my custom domain, right? Like: xxx.com/somethingblurred%20Release(1).apk
Chaika
Chaika15mo ago
Correct yea. If you were trying to do a setup where you wanted root (/) to return a specific file, you could use a Transform rule to accomplish that
Hanx
HanxOP15mo ago
Where I can find the transform rule?
Chaika
Chaika15mo ago
https://developers.cloudflare.com/rules/transform/url-rewrite/create-dashboard/, under Rules -> Transform Rules in Cloudflare dashboard for your website, magic link: https://dash.cloudflare.com/?to=/:account/:zone/rules/transform-rules/rewrite-url/new Specifically, you want URL Rewrite, something like this:
No description
Chaika
Chaika15mo ago
Transform rules are modifications to the path that get sent to the origin -- i.e there is no redirect/the user doesn't see their path change
Hanx
HanxOP15mo ago
Thanks very much Chaika. Thanks so much for your help. I will go and check it.
Want results from more Discord servers?
Add your server