nginxinc / nginx-s3-gateway

NGINX S3 Caching Gateway
Apache License 2.0
515 stars 127 forks source link

duplicate query parameters #205

Closed katrinaaquino1 closed 8 months ago

katrinaaquino1 commented 9 months ago

Describe the bug An extra set of query parameters is added to the URL

To Reproduce Steps to reproduce the behavior:

  1. Start container with APPEND_SLASH_FOR_POSSIBLE_DIRECTORY=true, ALLOW_DIRECTORY_LIST=false, PROVIDE_INDEX_PAGE=true, and an index.html file at /test/index.html
  2. Run container and navigate to /test?a=asd
  3. index.html loads but URL is updated to /test/?a=asd?a=asd

Expected behavior The index.html page loads and the URL remains /test?a=asd or updates to /test/?a=asd

Your environment Using the most recent version of the master branch - 0cdacac
Running the container using the included Dockerfile.oss file on localhost
Using AWS S3 as a backend

Additional context I noticed the duplication only happens when navigating to /test?a=asd, but not /test/?a=asd or /test/index.html?a=asd

4141done commented 9 months ago

Thank you for your report @katrinaaquino1 I will investigate this one this week

4141done commented 8 months ago

Hi @katrinaaquino1 I discovered the source of the bug and have a PR up to fix it here https://github.com/nginxinc/nginx-s3-gateway/pull/209

Would you be able to give it a test with your use case before I merge it? There are not any images pushed at the moment but if you have the ability to build and test it against your use case it would be appreciated.

katrinaaquino1 commented 8 months ago

@4141done This fix works for my use case. Thanks!

4141done commented 8 months ago

@katrinaaquino1 Thank you again for reporting this bug. The fix has been merged and new versions of the docker image with the fix are available on github packages and docker hub. Sorry for any inconvenience it may have caused 🙏

GH Packages: https://github.com/nginxinc/nginx-s3-gateway/pkgs/container/nginx-s3-gateway%2Fnginx-oss-s3-gateway/176123712?tag=latest-20240207

Dockerhub: https://hub.docker.com/layers/nginxinc/nginx-s3-gateway/latest-20240207/images/sha256-1cefcddd07a1154dfbc2e0ea3b603c1a824a0f197f4d060aa99c6224e680ac3f?context=explore

Please feel free to reopen this issue of the problem persists.