Skip to content

Commit f118f5e

Browse files
spacewanderbzp2010
andauthored
feat: release 2.12.1 (#6254)
Co-authored-by: Zeping Bai <[email protected]>
1 parent 6193a30 commit f118f5e

File tree

14 files changed

+275
-11
lines changed

14 files changed

+275
-11
lines changed

.github/workflows/chaos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: |
5555
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
5656
helm repo add bitnami https://charts.bitnami.com/bitnami
57-
helm install etcd bitnami/etcd --set replicaCount=3 --set auth.rbac.enabled=false
57+
helm install etcd bitnami/etcd --set replicaCount=3 --set auth.rbac.create=false
5858
kubectl wait pods -l app.kubernetes.io/instance=etcd --for=condition=Ready --timeout=300s --all
5959
6060

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ title: Changelog
2323

2424
## Table of Contents
2525

26+
- [2.12.1](#2121)
2627
- [2.12.0](#2120)
2728
- [2.11.0](#2110)
2829
- [2.10.3](#2103)
@@ -51,6 +52,13 @@ title: Changelog
5152
- [0.7.0](#070)
5253
- [0.6.0](#060)
5354

55+
## 2.12.1
56+
57+
### Bugfix
58+
59+
- fix(batch-requests): real ip header should be overridden [#6251](https://github.com/apache/apisix/pull/6251)
60+
- fix(batch-requests): should be disabled by default [#6204](https://github.com/apache/apisix/pull/6204)
61+
5462
## 2.12.0
5563

5664
### Change

apisix/core/version.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
-- limitations under the License.
1616
--
1717
return {
18-
VERSION = "2.12.0"
18+
VERSION = "2.12.1"
1919
}

apisix/plugins/batch-requests.lua

+2
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ local function set_common_header(data)
165165
local local_conf = core.config.local_conf()
166166
local real_ip_hdr = core.table.try_read_attr(local_conf, "nginx_config", "http",
167167
"real_ip_header")
168+
-- we don't need to handle '_' to '-' as Nginx won't treat 'X_REAL_IP' as 'X-Real-IP'
169+
real_ip_hdr = str_lower(real_ip_hdr)
168170

169171
local outer_headers = core.request.headers(nil)
170172
for i,req in ipairs(data.pipeline) do

conf/config-default.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ plugins: # plugin list (sorted by priority)
329329
- request-id # priority: 11010
330330
- fault-injection # priority: 11000
331331
- serverless-pre-function # priority: 10000
332-
- batch-requests # priority: 4010
332+
#- batch-requests # priority: 4010
333333
- cors # priority: 4000
334334
- ip-restriction # priority: 3000
335335
- ua-restriction # priority: 2999

docs/en/latest/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.12.0",
2+
"version": "2.12.1",
33
"sidebar": [
44
{
55
"type": "category",

docs/en/latest/how-to-build.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ Please refer to: [Installing Apache APISIX with Helm Chart](https://github.com/a
8181

8282
### Installation via Source Release Package
8383

84-
1. Create a directory named `apisix-2.12.0`.
84+
1. Create a directory named `apisix-2.12.1`.
8585

8686
```shell
87-
$ APISIX_VERSION='2.12.0'
87+
$ APISIX_VERSION='2.12.1'
8888
$ mkdir apisix-${APISIX_VERSION}
8989
```
9090

docs/zh/latest/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ title: CHANGELOG
2323

2424
## Table of Contents
2525

26+
- [2.12.1](#2121)
2627
- [2.12.0](#2120)
2728
- [2.11.0](#2110)
2829
- [2.10.3](#2103)
@@ -51,6 +52,13 @@ title: CHANGELOG
5152
- [0.7.0](#070)
5253
- [0.6.0](#060)
5354

55+
## 2.12.1
56+
57+
### Bugfix
58+
59+
- batch-requests 插件应当覆盖 real ip 请求头 [#6251](https://github.com/apache/apisix/pull/6251)
60+
- batch-requests 插件应当默认不启用 [#6204](https://github.com/apache/apisix/pull/6204)
61+
5462
## 2.12.0
5563

5664
### Change

docs/zh/latest/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.12.0",
2+
"version": "2.12.1",
33
"sidebar": [
44
{
55
"type": "category",

docs/zh/latest/how-to-build.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ $ sudo yum install ./apisix/*.rpm
8181

8282
### 通过源码包安装
8383

84-
1. 创建一个名为 `apisix-2.12.0` 的目录。
84+
1. 创建一个名为 `apisix-2.12.1` 的目录。
8585

8686
```shell
87-
$ APISIX_VERSION='2.12.0'
87+
$ APISIX_VERSION='2.12.1'
8888
$ mkdir apisix-${APISIX_VERSION}
8989
```
9090

rockspec/apisix-2.12.1-0.rockspec

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
--
2+
-- Licensed to the Apache Software Foundation (ASF) under one or more
3+
-- contributor license agreements. See the NOTICE file distributed with
4+
-- this work for additional information regarding copyright ownership.
5+
-- The ASF licenses this file to You under the Apache License, Version 2.0
6+
-- (the "License"); you may not use this file except in compliance with
7+
-- the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing, software
12+
-- distributed under the License is distributed on an "AS IS" BASIS,
13+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
-- See the License for the specific language governing permissions and
15+
-- limitations under the License.
16+
--
17+
18+
package = "apisix"
19+
version = "2.12.1-0"
20+
supported_platforms = {"linux", "macosx"}
21+
22+
source = {
23+
url = "git://github.com/apache/apisix",
24+
branch = "2.12.1",
25+
}
26+
27+
description = {
28+
summary = "Apache APISIX is a cloud-native microservices API gateway, delivering the ultimate performance, security, open source and scalable platform for all your APIs and microservices.",
29+
homepage = "https://github.com/apache/apisix",
30+
license = "Apache License 2.0",
31+
}
32+
33+
dependencies = {
34+
"lua-resty-ctxdump = 0.1-0",
35+
"lua-resty-dns-client = 5.2.3",
36+
"lua-resty-template = 2.0",
37+
"lua-resty-etcd = 1.6.0",
38+
"api7-lua-resty-http = 0.2.0",
39+
"lua-resty-balancer = 0.04",
40+
"lua-resty-ngxvar = 0.5.2",
41+
"lua-resty-jit-uuid = 0.0.7",
42+
"lua-resty-healthcheck-api7 = 2.2.0",
43+
"lua-resty-jwt = 0.2.0",
44+
"lua-resty-hmac-ffi = 0.05",
45+
"lua-resty-cookie = 0.1.0",
46+
"lua-resty-session = 2.24",
47+
"opentracing-openresty = 0.1",
48+
"lua-resty-radixtree = 2.8.1",
49+
"lua-protobuf = 0.3.3",
50+
"lua-resty-openidc = 1.7.2-1",
51+
"luafilesystem = 1.7.0-2",
52+
"api7-lua-tinyyaml = 0.4.2",
53+
"nginx-lua-prometheus = 0.20210206",
54+
"jsonschema = 0.9.6",
55+
"lua-resty-ipmatcher = 0.6.1",
56+
"lua-resty-kafka = 0.07",
57+
"lua-resty-logger-socket = 2.0-0",
58+
"skywalking-nginx-lua = 0.6.0",
59+
"base64 = 1.5-2",
60+
"binaryheap = 0.4",
61+
"dkjson = 2.5-2",
62+
"resty-redis-cluster = 1.02-4",
63+
"lua-resty-expr = 1.3.1",
64+
"graphql = 0.0.2",
65+
"argparse = 0.7.1-1",
66+
"luasocket = 3.0rc1-2",
67+
"luasec = 0.9-1",
68+
"lua-resty-consul = 0.3-2",
69+
"penlight = 1.9.2-1",
70+
"ext-plugin-proto = 0.3.0",
71+
"casbin = 1.26.0",
72+
"api7-snowflake = 2.0-1",
73+
"inspect == 3.1.1",
74+
"lualdap = 1.2.6-1",
75+
"lua-resty-rocketmq = 0.3.0-0",
76+
}
77+
78+
build = {
79+
type = "make",
80+
build_variables = {
81+
CFLAGS="$(CFLAGS)",
82+
LIBFLAG="$(LIBFLAG)",
83+
LUA_LIBDIR="$(LUA_LIBDIR)",
84+
LUA_BINDIR="$(LUA_BINDIR)",
85+
LUA_INCDIR="$(LUA_INCDIR)",
86+
LUA="$(LUA)",
87+
OPENSSL_INCDIR="$(OPENSSL_INCDIR)",
88+
OPENSSL_LIBDIR="$(OPENSSL_LIBDIR)",
89+
},
90+
install_variables = {
91+
ENV_INST_PREFIX="$(PREFIX)",
92+
ENV_INST_BINDIR="$(BINDIR)",
93+
ENV_INST_LIBDIR="$(LIBDIR)",
94+
ENV_INST_LUADIR="$(LUADIR)",
95+
ENV_INST_CONFDIR="$(CONFDIR)",
96+
},
97+
}

t/admin/plugins.t

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ zipkin
6868
request-id
6969
fault-injection
7070
serverless-pre-function
71-
batch-requests
7271
cors
7372
ip-restriction
7473
ua-restriction

t/debug/debug-mode.t

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ loaded plugin and sort by priority: 11011 name: zipkin
4848
loaded plugin and sort by priority: 11010 name: request-id
4949
loaded plugin and sort by priority: 11000 name: fault-injection
5050
loaded plugin and sort by priority: 10000 name: serverless-pre-function
51-
loaded plugin and sort by priority: 4010 name: batch-requests
5251
loaded plugin and sort by priority: 4000 name: cors
5352
loaded plugin and sort by priority: 3000 name: ip-restriction
5453
loaded plugin and sort by priority: 2990 name: referer-restriction

t/plugin/batch-requests2.t

+151
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,154 @@ plugin_attr:
224224
ngx.status = 200
225225
}
226226
}
227+
228+
229+
230+
=== TEST 5: ensure real ip header is overridden
231+
--- config
232+
location = /aggregate {
233+
content_by_lua_block {
234+
local core = require("apisix.core")
235+
local t = require("lib.test_admin").test
236+
local code, body = t('/apisix/batch-requests',
237+
ngx.HTTP_POST,
238+
[=[{
239+
"headers": {
240+
"x-real-ip": "127.0.0.2"
241+
},
242+
"pipeline":[
243+
{
244+
"path": "/c",
245+
"method": "PUT"
246+
}]
247+
}]=],
248+
[=[[
249+
{
250+
"status": 201,
251+
"body":"C",
252+
"headers": {
253+
"Client-IP": "127.0.0.1",
254+
"Client-IP-From-Hdr": "127.0.0.1"
255+
}
256+
}
257+
]]=])
258+
259+
ngx.status = code
260+
ngx.say(body)
261+
}
262+
}
263+
264+
location = /c {
265+
content_by_lua_block {
266+
ngx.status = 201
267+
ngx.header["Client-IP"] = ngx.var.remote_addr
268+
ngx.header["Client-IP-From-Hdr"] = ngx.req.get_headers()["x-real-ip"]
269+
ngx.print("C")
270+
}
271+
}
272+
--- request
273+
GET /aggregate
274+
--- response_body
275+
passed
276+
277+
278+
279+
=== TEST 6: ensure real ip header is overridden, header from the pipeline
280+
--- config
281+
location = /aggregate {
282+
content_by_lua_block {
283+
local core = require("apisix.core")
284+
local t = require("lib.test_admin").test
285+
local code, body = t('/apisix/batch-requests',
286+
ngx.HTTP_POST,
287+
[=[{
288+
"headers": {
289+
},
290+
"pipeline":[
291+
{
292+
"path": "/c",
293+
"headers": {
294+
"x-real-ip": "127.0.0.2"
295+
},
296+
"method": "PUT"
297+
}]
298+
}]=],
299+
[=[[
300+
{
301+
"status": 201,
302+
"body":"C",
303+
"headers": {
304+
"Client-IP": "127.0.0.1",
305+
"Client-IP-From-Hdr": "127.0.0.1"
306+
}
307+
}
308+
]]=])
309+
310+
ngx.status = code
311+
ngx.say(body)
312+
}
313+
}
314+
315+
location = /c {
316+
content_by_lua_block {
317+
ngx.status = 201
318+
ngx.header["Client-IP"] = ngx.var.remote_addr
319+
ngx.header["Client-IP-From-Hdr"] = ngx.req.get_headers()["x-real-ip"]
320+
ngx.print("C")
321+
}
322+
}
323+
--- request
324+
GET /aggregate
325+
--- response_body
326+
passed
327+
328+
329+
330+
=== TEST 7: ensure real ip header is overridden, header has underscore
331+
--- config
332+
location = /aggregate {
333+
content_by_lua_block {
334+
local core = require("apisix.core")
335+
local t = require("lib.test_admin").test
336+
local code, body = t('/apisix/batch-requests',
337+
ngx.HTTP_POST,
338+
[=[{
339+
"headers": {
340+
},
341+
"pipeline":[
342+
{
343+
"path": "/c",
344+
"headers": {
345+
"x_real-ip": "127.0.0.2"
346+
},
347+
"method": "PUT"
348+
}]
349+
}]=],
350+
[=[[
351+
{
352+
"status": 201,
353+
"body":"C",
354+
"headers": {
355+
"Client-IP": "127.0.0.1",
356+
"Client-IP-From-Hdr": "127.0.0.1"
357+
}
358+
}
359+
]]=])
360+
361+
ngx.status = code
362+
ngx.say(body)
363+
}
364+
}
365+
366+
location = /c {
367+
content_by_lua_block {
368+
ngx.status = 201
369+
ngx.header["Client-IP"] = ngx.var.remote_addr
370+
ngx.header["Client-IP-From-Hdr"] = ngx.req.get_headers()["x-real-ip"]
371+
ngx.print("C")
372+
}
373+
}
374+
--- request
375+
GET /aggregate
376+
--- response_body
377+
passed

0 commit comments

Comments
 (0)