Skip to content

Commit

Permalink
deletion: drop webdocket enable control in proxy-rewrite plugin (apac…
Browse files Browse the repository at this point in the history
…he#1332)

* deletion: drop webdocket enable control in proxy-rewrite plugin

* fix test-case
  • Loading branch information
lilien1010 authored and SaberMaster committed Jun 30, 2020
1 parent 354108b commit d789f4e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 156 deletions.
2 changes: 0 additions & 2 deletions doc/plugins/proxy-rewrite-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
|uri |可选| 转发到上游的新 `uri` 地址|
|regex_uri |可选| 转发到上游的新 `uri` 地址, 使用正则表达式匹配来自客户端的uri,当匹配成功后使用模板替换转发到上游的uri, 未匹配成功时将客户端请求的uri转发至上游。当`uri``regex_uri`同时存在时,`uri`优先被使用。例如:["^/iresty/(.*)/(.*)/(.*)","/$1-$2-$3"] 第一个元素代表匹配来自客户端请求的uri正则表达式,第二个元素代表匹配成功后转发到上游的uri模板|
|host |可选| 转发到上游的新 `host` 地址,例如:`iresty.com` |
|enable_websocket|可选| 是否启用 `websocket`(布尔值),默认不启用|
|headers |可选| 转发到上游的新`headers`,可以设置多个。头信息如果存在将重写,不存在则添加。想要删除某个 header 的话,把对应的值设置为空字符串即可|

### 示例
Expand All @@ -47,7 +46,6 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1
"uri": "/test/home.html",
"scheme": "http",
"host": "iresty.com",
"enable_websocket": true,
"headers": {
"X-Api-Version": "v1",
"X-Api-Engine": "apisix",
Expand Down
2 changes: 0 additions & 2 deletions doc/plugins/proxy-rewrite.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ upstream proxy info rewrite plugin.
|uri |optional| Upstream new `uri` forwarding address.|
|regex_uri |optional| Upstream new `uri` forwarding address. Use regular expression to match uri from client, when the match is successful, the uri template will be forwarded upstream. If the match is not successful, the uri from the client will be forwarded to the upstream. When `uri` and` regex_uri` are both exist, `uri` is used first. For example: [" ^/iresty/(.*)/(.*)/(.*)", "/$1-$2-$3"], the first element represents the matching regular expression and the second element represents the uri template that is forwarded to the upstream.|
|host |optional| Upstream new `host` forwarding address, example `iresty.com`. |
|enable_websocket|optional| enable `websocket`(boolean), default `false`.|
|headers |optional| Forward to the new `headers` of the upstream, can set up multiple. If it exists, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header.|

## How To Enable
Expand All @@ -54,7 +53,6 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1
"uri": "/test/home.html",
"scheme": "http",
"host": "iresty.com",
"enable_websocket": true,
"headers": {
"X-Api-Version": "v1",
"X-Api-Engine": "apisix",
Expand Down
10 changes: 0 additions & 10 deletions lua/apisix/plugins/proxy-rewrite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ local schema = {
type = "string",
enum = {"http", "https"}
},
enable_websocket = {
description = "enable websocket for request",
type = "boolean",
default = false
},
headers = {
description = "new headers for request",
type = "object",
Expand Down Expand Up @@ -155,11 +150,6 @@ function _M.rewrite(conf, ctx)
ctx.var.upstream_uri = upstream_uri
end

if conf.enable_websocket then
ctx.var.upstream_upgrade = ctx.var.http_upgrade
ctx.var.upstream_connection = ctx.var.http_connection
end

if conf.headers_arr then
local field_cnt = #conf.headers_arr
for i = 1, field_cnt, 2 do
Expand Down
Loading

0 comments on commit d789f4e

Please sign in to comment.