You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/18 09:28:48 UTC

[GitHub] [apisix] mangoGoForward opened a new pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

mangoGoForward opened a new pull request #6378:
URL: https://github.com/apache/apisix/pull/6378


   ### What this PR does / why we need it:
   Add curl test for redirect plugin's `http_to_https`, please see #3931.
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the PR manners:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. If you need to resolve merge conflicts after the PR is reviewed, please merge master but do not rebase
   6. Use "request review" to notify the reviewer once you have resolved the review
   7. Only reviewer can click "Resolve conversation" to mark the reviewer's review resolved
   -->
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [x] Have you modified the corresponding document?
   * [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r810717942



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       @mangoGoForward Just for the consistence of the documentation, look through the whole doc you'll find we don't use the default `80` port.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r810434094



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       Since we use `9080` to accept HTTP traffic, should we use `9443` here?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r820338731



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       Ping @tokers 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r810979588



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       Personally I think there is a bug, The generated Location header should respect the setting of SSL port, we cannot assume the SSL port is `443`.
   
   Also, my original meaning is quite simple, just because we use `9080` as the sample port to accept HTTP traffic, for the sake for consistence, I think using `9443` is better.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r821249728



##########
File path: docs/zh/latest/plugins/redirect.md
##########
@@ -115,6 +115,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+基于上述例子的测试示例:
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       ```suggestion
   Location: https://127.0.0.1:9443/hello
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander merged pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #6378:
URL: https://github.com/apache/apisix/pull/6378


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] mangoGoForward commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r810735963



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       > The default port for the APISIX proxy https protocol is 9443.
   
   @tokers See the `Location` header of response, it redirected to `https`. And I found some test cases in `t/plugin/redirect.t`:
   https://github.com/apache/apisix/blob/42e84e437fa532f24523f5b38015436e1fcc013f/t/plugin/redirect.t#L431-L438
   
   Seems we don't need to update?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] mangoGoForward commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r810469623



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       Why should be `9443`? and the default port of `https` is `443`.
   When `http_to_https` is set to true and the request is HTTP, it will be automatically redirected to HTTPS with 301 response code, and the URI will keep the same as client request.
   
   https://github.com/apache/apisix/blob/9b98f1d13187c58195543bd48cb8b66e33aeab27/apisix/plugins/redirect.lua#L155-L166




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] mangoGoForward commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r811081665



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       Sorry, I don't know how to use `9443` in this test case.
   
   Do we need create a upstream?

##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       Sorry, I don't know how to use `9443` in this test case.
   Do we need create an upstream?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r821249529



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       ```suggestion
   Location: https://127.0.0.1:9443/hello
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r810622980



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       > Why should be `9443`
   
   The default port for the APISIX proxy https protocol is 9443.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r811246542



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       This PR does not need to be modified in the test case to 9443, just use 9443 in the documentation? cc @tokers 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r810979588



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       Personally I think there is a bug, The generated Location header should respect the setting of SSL port, we cannot assume the SSL port is `443`.
   
   Also, my original meaning is quite simple, just because we use `9080` as the sample port to accept HTTP traffic in the doc, for the sake for consistence, I think using `9443` is better. If we use `80` to accept HTTP traffic, then using `443` is better.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers commented on a change in pull request #6378: docs: add curl test for redirect plugin's `http_to_https`.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #6378:
URL: https://github.com/apache/apisix/pull/6378#discussion_r820539473



##########
File path: docs/en/latest/plugins/redirect.md
##########
@@ -124,6 +124,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
+Testing based on the above examples :
+
+```shell
+$ curl http://127.0.0.1:9080/hello -i
+HTTP/1.1 301 Moved Permanently
+...
+Location: https://127.0.0.1/hello

Review comment:
       @tzssangglass is correct, just use `9443` in documentation is enough.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org