Skip to content
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

Fixes #164 #167

Merged
merged 6 commits into from
Sep 18, 2023
Merged

Fixes #164 #167

merged 6 commits into from
Sep 18, 2023

Conversation

dekobon
Copy link
Collaborator

@dekobon dekobon commented Aug 17, 2023

This PR fixes the issue #164

Expectations

This solution assumes that the following configuration options are set to true

  • APPEND_SLASH_FOR_POSSIBLE_DIRECTORY
  • PROVIDE_INDEX_PAGE
  • ALLOW_DIRECTORY_LIST

Given a folder test with an index.html present in the directory, the index.html should be served for:

  • /test
  • /test/
  • /test?foo=bar
  • /test/?foo=bar

Given a folder test WITHOUT an index.html present in the directory, files in the directory should be listed for:

  • /test
  • /test/
  • /test?foo=bar
  • /test/?foo=bar

Notes

  • The @trailslash was rewriting to $request_uri with a trailing slash on the end. In the case of /test?foo=bar we'd wind up with /test?foo=bar/ which when combined with the other changes led to a rewrite loop
  • Changed the check for directory or file to consider the path without anchor or querystring
  • I added yet another integration test suite and shuffled around the conditionals that maybe make the tests even more confusing - but do cover this case.

@4141done
Copy link
Collaborator

4141done commented Aug 18, 2023

I think your changes here look good, but doing some testing I found some odd behavior. I'm not 100% sure of all my conclusions, but I put together draft PR for your reference for possible inclusion into this change. #169

dekobon and others added 4 commits August 23, 2023 15:36
This change adds three new flags when using curl
to hit endpoints as part of integration tests:
--connect-timeout 3 --max-time 30 --no-progress-meter
This change allows for the test script to be run against
a container that is using a custom nginx build compiled
with the --with-debug flag.
The newest changes to njs require additional dependencies
for compilation. This change adds those dependencies and
brings the compiler flags closer to the configuration
provided by the OSS packages.
Copy link
Collaborator

@4141done 4141done left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dekobon I think these changes will accomplish the fix for issue #164

We have not received confirmation from the original reporter but some time has passed and this certainly a bug so I think we can move ahead with the fix.

If you could just look over my removal of the debug code and give a 👍 then I think we can merge.

@4141done 4141done merged commit ddb616e into nginxinc:master Sep 18, 2023
2 checks passed
elJosho pushed a commit to elJosho/nginx-s3-gateway that referenced this pull request Oct 25, 2023
This PR fixes the issue nginxinc#164 

## Expectations
This solution assumes that the following configuration options are set to true
* `APPEND_SLASH_FOR_POSSIBLE_DIRECTORY`
* `PROVIDE_INDEX_PAGE`
* `ALLOW_DIRECTORY_LIST`

Given a folder `test` **with** an `index.html` present in the directory, the `index.html` should be served for:
* `/test`
* `/test/`
* `/test?foo=bar`
* `/test/?foo=bar`

Given a folder `test` **WITHOUT** an `index.html` present in the directory, files in the directory should be listed for:
* `/test`
* `/test/`
* `/test?foo=bar`
* `/test/?foo=bar`

## Notes
* The `@trailslash` was rewriting to `$request_uri` with a trailing slash on the end.  In the case of `/test?foo=bar` we'd wind up with `/test?foo=bar/` which when combined with the other changes led to a rewrite loop
* Changed the check for directory or file to consider the path without anchor or querystring
* Added yet another integration test suite and shuffled around the conditionals that maybe make the tests even more confusing - but do cover this case.

Co-authored-by: Javier Evans <[email protected]>

* make the isDirectory check simpler and more inclusive of error states

* Allow useful output from curl and enable timeouts

This change adds three new flags when using curl
to hit endpoints as part of integration tests:
--connect-timeout 3 --max-time 30 --no-progress-meter

---------

Co-authored-by: Javier Evans <[email protected]>
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