Skip to content

Added root path prefix in listings template #135

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

Closed
wants to merge 5 commits into from

Conversation

zc-devs
Copy link
Contributor

@zc-devs zc-devs commented May 26, 2023

Hello.

I list my S3 bucket under some prefix. Currently nginx-s3-gateway doesn't allow it. I can (and I do) strip prefix in HAProxy, but get links without prefix in listing. See diagram below:

nginx-s3-gw-path-prefix

So, this PR prefixes links in directory listing with some predefined value. If it looks good, then I'll add variable into other containers and documentation.

@dekobon
Copy link
Collaborator

dekobon commented May 30, 2023

// dang, I just noticed this was a draft PR, please excuse my premature comments/feedback

Thank you for your contribution. I'd like to see a few changes before merging.

First, the TODOs:

  1. Can you update the documentation to include the new environment?
  2. Can you verify that the stand-alone install script supports the changes?

@zc-devs
Copy link
Contributor Author

zc-devs commented May 30, 2023

@dekobon, no problem.

Sure, I can resolve TODOs. Just signal me if we are going with it in general. Does it suit an architecture, etc?

@dekobon
Copy link
Collaborator

dekobon commented May 30, 2023

@dekobon, no problem.

Sure, I can resolve TODOs. Just signal me if we are going with it in general. Does it suit an architecture, etc?

Yes! This would be a good feature.

@zc-devs zc-devs force-pushed the dir-list-prefix branch from 8e3f62b to 6990e59 Compare May 31, 2023 13:01
@zc-devs zc-devs marked this pull request as ready for review May 31, 2023 13:24
@zc-devs
Copy link
Contributor Author

zc-devs commented Jun 10, 2023

Hi Elijah @dekobon,

Does it look good for you? Could you merge PR?

@dekobon
Copy link
Collaborator

dekobon commented Jun 13, 2023

Excuse my lateness in addressing this PR. I tried to test out the PR, and I saw the following behavior. I see the following after enabling DIRECTORY_LISTING_PATH_PREFIX=main/

  1. The root directory list when accessed at / (http://localhost) returns an index page that displays as though it was at the /main path.
  2. If I navigate to a file from the directory listing, I get a 404 because the path to the file is prepended with a main/ path.

I want to make sure that my understanding of the behavior is correct. I did not understand the behavior well based on the text in the readme.

To confirm, this change modifies the paths presented by the index page, but does not change the actual paths served. Is that correct?

@zc-devs
Copy link
Contributor Author

zc-devs commented Jun 13, 2023

Yes, you're absolutely right.

I make requests through another proxy (in my case via HAProxy), which removes the same prefix from request path:
http-request set-path %[path,regsub(^/main,/)]

I tried to make it in nginx-s3-gateway, but with no luck.

@dekobon
Copy link
Collaborator

dekobon commented Jun 14, 2023

I've made some changes to your PR and pushed it as a branch here: https://github.com/dekobon/nginx-s3-gateway/tree/dir-list-prefix

In particular, I removed the templating done on the includes directory and instead used an xlst parameter.

Please take a look at the above branch, test with your configuration and let me know the results.

If it works for you, then I'd like to merge it.

@zc-devs
Copy link
Contributor Author

zc-devs commented Jun 15, 2023

Hi.
Your fixes work. Let's merge it.
Thank you.

@dekobon
Copy link
Collaborator

dekobon commented Jun 15, 2023

Changes merged in commits:
e4c95c4
54653a8
8b57860
f491aaf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants