-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make allow-directory-listing and provide-index-page compatible #112
Comments
Hi @johanvdw, even if we wanted to do two requests to s3, I don't think we can do it with the current implementation of nginx and njs. If we make a s3 gateway binary module, then it may be possible. |
@dekobon, I also have a use case where I need both Is there any way we could make this work? I'm happy to open a PR if we can agree on an approach. |
There may be a way now. Njs now supports XML So, you could parse the output of the directory list results and determine if there are no results. Basically, you would rewrite the logic here. Then, one may could use fetch to get the index page. When doing that, you may actually want to fetch the index page by querying the S3 gateway itself over localhost so that the aws auth creds are embedded. |
Ok. I will try to take a look at this when time permits. Please feel free to leave additional feedback on the approach if anything comes to mind. In the meantime, can you re-open this issue, @dekobon? |
Hi @dekobon, there might be an issue with the mentioned approach. I found the following in the docs:
It is not immediately clear how the fetch (being an async function) should be implemented within the logic here given this limitation. Could you provide additional feedback? |
I wonder if you could modify it to a redirect of the location of the index page? |
Hmm, seems like |
Please see my comments on the PR. |
This issue can be closed now that #139 is merged. Though we will likely open a subsequent PR to switch the following lines to use a nginx-s3-gateway/common/etc/nginx/include/s3gateway.js Lines 357 to 359 in 309053c
|
Thank you @ajschmidt8 ! Resolved in PR #139 |
I wonder if it is somehow possible to have directory listings in case the index.html page does not exist. I realise that in that case two requests to s3 have to be made, either first the page and then the listing if that fails, or first the listing and then the page if it is in the list.
The text was updated successfully, but these errors were encountered: