fix: Solve an issue where rewrites due to APPEND_SLASH_FOR_POSSIBLE_DIRECTORY would cause duplication of the query string #209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
As reported here #205 when
APPEND_SLASH_FOR_POSSIBLE_DIRECTORY=true
ALLOW_DIRECTORY_LIST=false
PROVIDE_INDEX_PAGE=true
Are set, requests containing query strings without a trailing slash were being duplicated (
foo?a=b
were becomingfoo?a=b?a=b
).Cause
The
rewrite
directive will automatically append the query string unless a final trailing?
is supplied. This was causing the duplicationFix
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.