fix: the query string is repeated twice when enable http-to-https and append-query-string (#7394)#7433
Merged
spacewander merged 3 commits intoapache:masterfrom Jul 14, 2022
Conversation
… append-query-string (apache#7394)
tokers
reviewed
Jul 11, 2022
docs/en/latest/plugins/redirect.md
Outdated
| | Name | Type | Required | Default | Valid values | Description | | ||
| |---------------------|---------------|----------|---------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | http_to_https | boolean | False | false | | When set to `true` and the request is HTTP, it will be redirected to HTTPS with the same URI with a 301 status code. | | ||
| | http_to_https | boolean | False | false | | When set to `true` and the request is HTTP, it will be redirected to HTTPS with the same URI with a 301 status code, contains the query string. | |
Contributor
There was a problem hiding this comment.
Suggested change
| | http_to_https | boolean | False | false | | When set to `true` and the request is HTTP, it will be redirected to HTTPS with the same URI with a 301 status code, contains the query string. | | |
| | http_to_https | boolean | False | false | | When set to `true` and the request is HTTP, it will be redirected to HTTPS with the same URI with a 301 status code. Note the querystring from the raw URI will also be contained in the Location header. | |
docs/en/latest/plugins/redirect.md
Outdated
Comment on lines
+46
to
+47
| Only one of `http_to_https`, `uri` and `regex_uri` can be configured. | ||
| Only one of `http_to_https` and `append_query_string` can be configured. |
Contributor
There was a problem hiding this comment.
Suggested change
| Only one of `http_to_https`, `uri` and `regex_uri` can be configured. | |
| Only one of `http_to_https` and `append_query_string` can be configured. | |
| * Only one of `http_to_https`, `uri` and `regex_uri` can be configured. | |
| * Only one of `http_to_https` and `append_query_string` can be configured. |
t/plugin/redirect.t
Outdated
|
|
||
|
|
||
| === TEST 26: enable http_to_https with upstream | ||
| === TEST 26: wrong configure, enable http_to_https with append_query_string |
Contributor
There was a problem hiding this comment.
Let's change the test case position to the end of the file (so there won't' have many test number changes).
spacewander
reviewed
Jul 12, 2022
| oneOf = { | ||
| {required = {"uri"}}, | ||
| {required = {"regex_uri"}}, | ||
| {required = {"http_to_https"}} |
Member
There was a problem hiding this comment.
Contributor
Author
There was a problem hiding this comment.
I have tried, but not succeed
["not"] = {
allOf = {
{required = {"append_query_string"}},
{required = {"http_to_https"}},
}
}
and
["not"] = {required = {"append_query_string", "http_to_https"}},
Member
There was a problem hiding this comment.
http_to_https = {
["not"] = {required = {"uri", "regex_uri", "append_query_string"}}
},
uri = {
["not"] = {required = {"regex_uri", "http_to_https"}}
},
regex_uri = {
["not"] = {required = {"uri", "http_to_https"}}
},
what about this form?
Member
There was a problem hiding this comment.
Give it a try:
oneOf = {
{required = {"uri"}},
{required = {"regex_uri"}},
{required = {"http_to_https"}, ["not"] = {
required = {"append_query_string"}
}}
}
Contributor
Author
There was a problem hiding this comment.
Give it a try:
oneOf = { {required = {"uri"}}, {required = {"regex_uri"}}, {required = {"http_to_https"}, ["not"] = { required = {"append_query_string"} }} }
It does work, i have updated, please check @spacewander
tokers
approved these changes
Jul 14, 2022
tzssangglass
approved these changes
Jul 14, 2022
spacewander
approved these changes
Jul 14, 2022
Liu-Junlin
pushed a commit
to Liu-Junlin/apisix
that referenced
this pull request
Nov 4, 2022
… append-query-string (apache#7394) (apache#7433)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fix bug that the query string is repeated twice when enable http-to-https and append-query-string
Fixes #7394
Checklist