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 2020/05/18 03:02:32 UTC

[GitHub] [incubator-apisix] moonming opened a new pull request #1595: test cases: add doc and test cases for how to redirect http to https.

moonming opened a new pull request #1595:
URL: https://github.com/apache/incubator-apisix/pull/1595


   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] agile6v merged pull request #1595: test cases: add doc and test cases for how to redirect http to https.

Posted by GitBox <gi...@apache.org>.
agile6v merged pull request #1595:
URL: https://github.com/apache/incubator-apisix/pull/1595


   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] agile6v commented on a change in pull request #1595: test cases: add doc and test cases for how to redirect http to https.

Posted by GitBox <gi...@apache.org>.
agile6v commented on a change in pull request #1595:
URL: https://github.com/apache/incubator-apisix/pull/1595#discussion_r426627626



##########
File path: FAQ_CN.md
##########
@@ -109,9 +110,77 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335
 }'
 ```
 
+
 更多的 lua-resty-radixtree 匹配操作,可查看操作列表:
 https://github.com/iresty/lua-resty-radixtree#operator-list
 
+## 如何支持 http 自动跳转到 https?
+
+比如,将 `http://foo.com` 重定向到 `https://foo.com`
+
+有几种不同的方法来实现:
+1. 使用`redirect`插件:
+
+```shell
+curl -i http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "host": "foo.com",
+    "vars": [
+        [
+            "scheme",
+            "==",
+            "http"
+        ]
+    ],
+    "plugins": {
+        "redirect": {
+            "uri": "https://$host$request_uri",
+            "ret_code": 301
+        }
+    }
+}'
+```
+
+1. 使用`serverless`插件:

Review comment:
       1 -> 2?

##########
File path: FAQ.md
##########
@@ -107,11 +107,81 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335
 }'
 ```
 
+
 Here is the operator list of current `lua-resty-radixtree`:
 https://github.com/iresty/lua-resty-radixtree#operator-list
 
+## How to redirect http to https via APISIX?
+
+An example, redirect `http://foo.com` to `https://foo.com`
+
+There are several different ways to do this.
+1. `redirect` plugin:
+
+```shell
+curl -i http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "host": "foo.com",
+    "vars": [
+        [
+            "scheme",
+            "==",
+            "http"
+        ]
+    ],
+    "plugins": {
+        "redirect": {
+            "uri": "https://$host$request_uri",
+            "ret_code": 301
+        }
+    }
+}'
+```
+
+1. `serverless` plugin:

Review comment:
       1 -> 2 ?




----------------------------------------------------------------
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.

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



[GitHub] [incubator-apisix] membphis commented on a change in pull request #1595: test cases: add doc and test cases for how to redirect http to https.

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1595:
URL: https://github.com/apache/incubator-apisix/pull/1595#discussion_r429985906



##########
File path: FAQ.md
##########
@@ -107,11 +107,81 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335
 }'
 ```
 
+
 Here is the operator list of current `lua-resty-radixtree`:
 https://github.com/iresty/lua-resty-radixtree#operator-list
 
+## How to redirect http to https via APISIX?
+
+An example, redirect `http://foo.com` to `https://foo.com`
+
+There are several different ways to do this.
+1. `redirect` plugin:
+
+```shell
+curl -i http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/hello",
+    "host": "foo.com",
+    "vars": [
+        [
+            "scheme",
+            "==",
+            "http"
+        ]
+    ],
+    "plugins": {
+        "redirect": {
+            "uri": "https://$host$request_uri",
+            "ret_code": 301
+        }
+    }
+}'
+```
+
+1. `serverless` plugin:

Review comment:
       @moonming any news?
   
   ![image](https://user-images.githubusercontent.com/6814606/82825420-cba87f80-9edd-11ea-982c-a8ca1582be67.png)
   




----------------------------------------------------------------
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.

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