Skip to content

Commit

Permalink
feat: release 2.12.1 (#6254)
Browse files Browse the repository at this point in the history
Co-authored-by: Zeping Bai <[email protected]>
  • Loading branch information
spacewander and bzp2010 authored Feb 7, 2022
1 parent 6193a30 commit f118f5e
Show file tree
Hide file tree
Showing 14 changed files with 275 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chaos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install etcd bitnami/etcd --set replicaCount=3 --set auth.rbac.enabled=false
helm install etcd bitnami/etcd --set replicaCount=3 --set auth.rbac.create=false
kubectl wait pods -l app.kubernetes.io/instance=etcd --for=condition=Ready --timeout=300s --all
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ title: Changelog

## Table of Contents

- [2.12.1](#2121)
- [2.12.0](#2120)
- [2.11.0](#2110)
- [2.10.3](#2103)
Expand Down Expand Up @@ -51,6 +52,13 @@ title: Changelog
- [0.7.0](#070)
- [0.6.0](#060)

## 2.12.1

### Bugfix

- fix(batch-requests): real ip header should be overridden [#6251](https://github.com/apache/apisix/pull/6251)
- fix(batch-requests): should be disabled by default [#6204](https://github.com/apache/apisix/pull/6204)

## 2.12.0

### Change
Expand Down
2 changes: 1 addition & 1 deletion apisix/core/version.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
-- limitations under the License.
--
return {
VERSION = "2.12.0"
VERSION = "2.12.1"
}
2 changes: 2 additions & 0 deletions apisix/plugins/batch-requests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ local function set_common_header(data)
local local_conf = core.config.local_conf()
local real_ip_hdr = core.table.try_read_attr(local_conf, "nginx_config", "http",
"real_ip_header")
-- we don't need to handle '_' to '-' as Nginx won't treat 'X_REAL_IP' as 'X-Real-IP'
real_ip_hdr = str_lower(real_ip_hdr)

local outer_headers = core.request.headers(nil)
for i,req in ipairs(data.pipeline) do
Expand Down
2 changes: 1 addition & 1 deletion conf/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ plugins: # plugin list (sorted by priority)
- request-id # priority: 11010
- fault-injection # priority: 11000
- serverless-pre-function # priority: 10000
- batch-requests # priority: 4010
#- batch-requests # priority: 4010
- cors # priority: 4000
- ip-restriction # priority: 3000
- ua-restriction # priority: 2999
Expand Down
2 changes: 1 addition & 1 deletion docs/en/latest/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.12.0",
"version": "2.12.1",
"sidebar": [
{
"type": "category",
Expand Down
4 changes: 2 additions & 2 deletions docs/en/latest/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ Please refer to: [Installing Apache APISIX with Helm Chart](https://github.com/a

### Installation via Source Release Package

1. Create a directory named `apisix-2.12.0`.
1. Create a directory named `apisix-2.12.1`.

```shell
$ APISIX_VERSION='2.12.0'
$ APISIX_VERSION='2.12.1'
$ mkdir apisix-${APISIX_VERSION}
```

Expand Down
8 changes: 8 additions & 0 deletions docs/zh/latest/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ title: CHANGELOG

## Table of Contents

- [2.12.1](#2121)
- [2.12.0](#2120)
- [2.11.0](#2110)
- [2.10.3](#2103)
Expand Down Expand Up @@ -51,6 +52,13 @@ title: CHANGELOG
- [0.7.0](#070)
- [0.6.0](#060)

## 2.12.1

### Bugfix

- batch-requests 插件应当覆盖 real ip 请求头 [#6251](https://github.com/apache/apisix/pull/6251)
- batch-requests 插件应当默认不启用 [#6204](https://github.com/apache/apisix/pull/6204)

## 2.12.0

### Change
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/latest/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.12.0",
"version": "2.12.1",
"sidebar": [
{
"type": "category",
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/latest/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ $ sudo yum install ./apisix/*.rpm

### 通过源码包安装

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

```shell
$ APISIX_VERSION='2.12.0'
$ APISIX_VERSION='2.12.1'
$ mkdir apisix-${APISIX_VERSION}
```

Expand Down
97 changes: 97 additions & 0 deletions rockspec/apisix-2.12.1-0.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

package = "apisix"
version = "2.12.1-0"
supported_platforms = {"linux", "macosx"}

source = {
url = "git://github.com/apache/apisix",
branch = "2.12.1",
}

description = {
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.",
homepage = "https://github.com/apache/apisix",
license = "Apache License 2.0",
}

dependencies = {
"lua-resty-ctxdump = 0.1-0",
"lua-resty-dns-client = 5.2.3",
"lua-resty-template = 2.0",
"lua-resty-etcd = 1.6.0",
"api7-lua-resty-http = 0.2.0",
"lua-resty-balancer = 0.04",
"lua-resty-ngxvar = 0.5.2",
"lua-resty-jit-uuid = 0.0.7",
"lua-resty-healthcheck-api7 = 2.2.0",
"lua-resty-jwt = 0.2.0",
"lua-resty-hmac-ffi = 0.05",
"lua-resty-cookie = 0.1.0",
"lua-resty-session = 2.24",
"opentracing-openresty = 0.1",
"lua-resty-radixtree = 2.8.1",
"lua-protobuf = 0.3.3",
"lua-resty-openidc = 1.7.2-1",
"luafilesystem = 1.7.0-2",
"api7-lua-tinyyaml = 0.4.2",
"nginx-lua-prometheus = 0.20210206",
"jsonschema = 0.9.6",
"lua-resty-ipmatcher = 0.6.1",
"lua-resty-kafka = 0.07",
"lua-resty-logger-socket = 2.0-0",
"skywalking-nginx-lua = 0.6.0",
"base64 = 1.5-2",
"binaryheap = 0.4",
"dkjson = 2.5-2",
"resty-redis-cluster = 1.02-4",
"lua-resty-expr = 1.3.1",
"graphql = 0.0.2",
"argparse = 0.7.1-1",
"luasocket = 3.0rc1-2",
"luasec = 0.9-1",
"lua-resty-consul = 0.3-2",
"penlight = 1.9.2-1",
"ext-plugin-proto = 0.3.0",
"casbin = 1.26.0",
"api7-snowflake = 2.0-1",
"inspect == 3.1.1",
"lualdap = 1.2.6-1",
"lua-resty-rocketmq = 0.3.0-0",
}

build = {
type = "make",
build_variables = {
CFLAGS="$(CFLAGS)",
LIBFLAG="$(LIBFLAG)",
LUA_LIBDIR="$(LUA_LIBDIR)",
LUA_BINDIR="$(LUA_BINDIR)",
LUA_INCDIR="$(LUA_INCDIR)",
LUA="$(LUA)",
OPENSSL_INCDIR="$(OPENSSL_INCDIR)",
OPENSSL_LIBDIR="$(OPENSSL_LIBDIR)",
},
install_variables = {
ENV_INST_PREFIX="$(PREFIX)",
ENV_INST_BINDIR="$(BINDIR)",
ENV_INST_LIBDIR="$(LIBDIR)",
ENV_INST_LUADIR="$(LUADIR)",
ENV_INST_CONFDIR="$(CONFDIR)",
},
}
1 change: 0 additions & 1 deletion t/admin/plugins.t
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ zipkin
request-id
fault-injection
serverless-pre-function
batch-requests
cors
ip-restriction
ua-restriction
Expand Down
1 change: 0 additions & 1 deletion t/debug/debug-mode.t
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ loaded plugin and sort by priority: 11011 name: zipkin
loaded plugin and sort by priority: 11010 name: request-id
loaded plugin and sort by priority: 11000 name: fault-injection
loaded plugin and sort by priority: 10000 name: serverless-pre-function
loaded plugin and sort by priority: 4010 name: batch-requests
loaded plugin and sort by priority: 4000 name: cors
loaded plugin and sort by priority: 3000 name: ip-restriction
loaded plugin and sort by priority: 2990 name: referer-restriction
Expand Down
151 changes: 151 additions & 0 deletions t/plugin/batch-requests2.t
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,154 @@ plugin_attr:
ngx.status = 200
}
}
=== TEST 5: ensure real ip header is overridden
--- config
location = /aggregate {
content_by_lua_block {
local core = require("apisix.core")
local t = require("lib.test_admin").test
local code, body = t('/apisix/batch-requests',
ngx.HTTP_POST,
[=[{
"headers": {
"x-real-ip": "127.0.0.2"
},
"pipeline":[
{
"path": "/c",
"method": "PUT"
}]
}]=],
[=[[
{
"status": 201,
"body":"C",
"headers": {
"Client-IP": "127.0.0.1",
"Client-IP-From-Hdr": "127.0.0.1"
}
}
]]=])
ngx.status = code
ngx.say(body)
}
}
location = /c {
content_by_lua_block {
ngx.status = 201
ngx.header["Client-IP"] = ngx.var.remote_addr
ngx.header["Client-IP-From-Hdr"] = ngx.req.get_headers()["x-real-ip"]
ngx.print("C")
}
}
--- request
GET /aggregate
--- response_body
passed
=== TEST 6: ensure real ip header is overridden, header from the pipeline
--- config
location = /aggregate {
content_by_lua_block {
local core = require("apisix.core")
local t = require("lib.test_admin").test
local code, body = t('/apisix/batch-requests',
ngx.HTTP_POST,
[=[{
"headers": {
},
"pipeline":[
{
"path": "/c",
"headers": {
"x-real-ip": "127.0.0.2"
},
"method": "PUT"
}]
}]=],
[=[[
{
"status": 201,
"body":"C",
"headers": {
"Client-IP": "127.0.0.1",
"Client-IP-From-Hdr": "127.0.0.1"
}
}
]]=])
ngx.status = code
ngx.say(body)
}
}
location = /c {
content_by_lua_block {
ngx.status = 201
ngx.header["Client-IP"] = ngx.var.remote_addr
ngx.header["Client-IP-From-Hdr"] = ngx.req.get_headers()["x-real-ip"]
ngx.print("C")
}
}
--- request
GET /aggregate
--- response_body
passed
=== TEST 7: ensure real ip header is overridden, header has underscore
--- config
location = /aggregate {
content_by_lua_block {
local core = require("apisix.core")
local t = require("lib.test_admin").test
local code, body = t('/apisix/batch-requests',
ngx.HTTP_POST,
[=[{
"headers": {
},
"pipeline":[
{
"path": "/c",
"headers": {
"x_real-ip": "127.0.0.2"
},
"method": "PUT"
}]
}]=],
[=[[
{
"status": 201,
"body":"C",
"headers": {
"Client-IP": "127.0.0.1",
"Client-IP-From-Hdr": "127.0.0.1"
}
}
]]=])
ngx.status = code
ngx.say(body)
}
}
location = /c {
content_by_lua_block {
ngx.status = 201
ngx.header["Client-IP"] = ngx.var.remote_addr
ngx.header["Client-IP-From-Hdr"] = ngx.req.get_headers()["x-real-ip"]
ngx.print("C")
}
}
--- request
GET /aggregate
--- response_body
passed

0 comments on commit f118f5e

Please sign in to comment.