Replies: 1 comment 2 replies
-
interesting - perhaps an optional metafile in each directory could support this in a simple way instead of tunneling yet more info through string params? this way you could declare even very complex access rules at many levels Something like |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
About Denoflare's R2
listDirectories
, is it possible to limit the dir listed to only the ones we want them to be "public" instead of listing the entire bucket?Examples as shown below:
Scenario 1
We could enable
listDirectories
at the root level, but make a separate optional config in the~/.denoflare.jsonc
to only show certain directories that we want to be publicly listed. Anything else that aren't declared there should be private and will give a 404 response, unless the requested url path is correctly pointed to a certain file.The
listDirectories
at the root level is useful to access customindex.html
and/or404.html
at the root level, so that404.html
applies everytime someone gets the404 status
.Scenario 2
If Scenario 1 is quite hard to achieve, Scenario 2 might be easier.
Here in Scenario 2, instead of enabling
listDirectories
at the root level, there should be an optional config in the~/.denoflare.jsonc
to set a custom url path that we want to be listed as the root directory. So we will put the404.html
to this custom root path.It might not give the same level of privacy as Scenario 1, but it will still be useful in some way, knowing that we can make certain directory listed as public and use that as a root, instead of listing the entire bucket.
So we don't need to migrate files in that bucket, that we don't want to be listed, to a separate bucket.
Additional Scenario
Either Scenario 1 or 2, both should have the ability to add multiple directories that we want to be listed, and keep anything else private.
This might be possible by declaring something in the
~/.denoflare.jsonc
likeThe above config example might be suitable for Scenario 2, while for Scenario 1, listing the bucket at the root level isn't a good idea unless it's only for the custom
404.html
we want to put at the root level.In the end, Scenario 1 will force denoflare to support multiple separate directories that we only want to be listed as public, while keeping anything else unlisted. Something like this
Maybe the only difference is that Scenario 2 only supports 1 custom "root dir" instead of using the entire bucket as the root,
while Scenario 1 kinda supports multiple "sub-root dir" (the root Parent dir is the bucket with the custom
404.html
there, and the sub-root directories act as the ones you want to be publicly listed, and give404.html
as a response whenever a user requests any other paths other than the ones listed in"dirYouWantToBePubliclyListedFromTheRootLevel"
— unless the user correctly specifies a path that points to a certain file in the bucket).I couldn't find a related example to do that from the r2-public-read example.
I'd like to discuss it here first, whether the above scenarios are possible or not.
Beta Was this translation helpful? Give feedback.
All reactions