nginxinc / nginx-s3-gateway

NGINX S3 Caching Gateway
Apache License 2.0
496 stars 126 forks source link

fix: Solve an issue where rewrites due to APPEND_SLASH_FOR_POSSIBLE_DIRECTORY would cause duplication of the query string #209

Closed 4141done closed 7 months ago

4141done commented 7 months ago

What

As reported here https://github.com/nginxinc/nginx-s3-gateway/issues/205 when

Cause

The rewrite directive will automatically append the query string unless a final trailing ? is supplied. This was causing the duplication

Fix

Added an explanatory comment and a trailing ? to the rewrite rule to prevent automatic appending of the query string as we already do it in the argument to the rewrite rule.

I chose to do this rather than depending on the default behavior of rewrite since the rule as it is expressed is more explicit. The trailing ? is mysterious and so a comment was included to clarify.