Following the release of Version 2.11.0, Apache APISIX is bringing the first release of 2022 with new features for the upcoming Spring Festival. Here also calculate hand in hand new version to everyone worship an early years!

New features: More Serverless integration

Remember that in the last release Apache APISIX added support for Azure Function. And this new version is also full of intentions, in the function to add more Serverless vendor support.

Users can now also combine AWS Lambda with Apache OpenWhisk in Apache APISIX to expose specific functions on the gateway.

New feature: More authentication plugins

The new version will also bring two long-awaited new plug-ins: Forward-Auth and OPA.

  • forward-authThe plug-in is similar to Traefik’s plug-in of the same name, which allows information about the current request to be sent to an external service for authentication.
  • opaThe plug-in integrates the well-known Open Policy Agent, which can complete complex authentication functions through OPA.

The two plugins above add to the authentication function of Apache APISIX, bringing more rich and easy authentication operations to users.

New: More logging capabilities

In addition to the authentication plugins mentioned above, this release will also bring three new logging plugins: Google-Cloud-Logging, Splunk-Hec-Logging, and RocketMq-Logger.

It’s also easy to understand from the name of the plug-in that logs can be sent to Google Cloud, Splunk, and Apache RocketMQ, respectively. In the future, Apache APISIX will connect with more and more logging services and open source brokers to make logging easier.

Support for recording response bodies

At the same time, version 2.12.0 also supports logging response bodies at the logging level. Like other Apache APISIX features, this feature can be dynamically turned on through expressions. This allows logging only when a specific content-Type or Content-Length is returned upstream, without worrying about the problem of collecting the response body in full.

Specific examples can be found below:

Plugins: {"kafka-logger": {"broker_list" : {"127.0.0.1":9092}, "kafka_topic" : "test2", "include_resp_body": true, "include_resp_body_expr": [ [ "sent_http_content_length", "<", "4096" ], [ "sent_http_content_type", "==", "application/json" ], ] } }, "Upstream" : {" nodes ": {" 127.0.0.1:1980" : 1}, "type" : "roundrobin}", "uri" : "/ hello}"Copy the code

The preceding configuration will be logged only when content-Length < 4096 and content-Type is “application/json”.

Support for registering custom variables

Another feature closely related to logging is that the new version of Apache APISIX now supports registering custom variables. Combined with APISIX’s custom log format, the reported log content can be fully customized. That is, the decoupling of log generation and reporting can be achieved without modifying the specific log plug-in. Here is a simple demonstration with an example.

For example, we can register a6_route_labels as a variable in our plugin:

local core = require "apisix.core"



core.ctx.register_var("a6_route_labels", function(ctx)

    local route = ctx.matched_route and ctx.matched_route.value

    if route and route.labels then

        return route.labels

    end

    return nil

end)
Copy the code

And use it in a custom log format:

{

    "log_format": {

        "host": "$host",

        "labels": "$a6_route_labels",

        "client_ip": "$remote_addr"

    }

}
Copy the code

Suppose our Route looks like this:

{" plugins ": {" HTTP - logger" : {" uri ":" http://127.0.0.1:1980/log ", "batch_max_size" : 1, "concat_method" : "Json"}}, "upstream" : {" nodes ": {" 127.0.0.1:1982" : 1}, "type" : "roundrobin}", "labels" : {" k ":" v "}, "uri" : "/hello" }Copy the code

You end up with a log like this:

{" client_ip ":" 127.0.0.1 ", "the host" : "localhost", "labels" : {" k ":" v "}, "route_id" : "1"}Copy the code

New: L4 proxy supports TLS over TCP upstream

With the introduction of the new Upstream Scheme in 2.12.0, Apache APISIX now supports proxies Upstream to TLS over TCP.

To do this, just specify Scheme as TLS in Upstream configuration.

{" scheme ":" the TLS ", "nodes" : {" 127.0.0.1:1995 ": 1}," type ":" roundrobin}"Copy the code

So far, The TCP proxy function of Apache APISIX has been fully supported by TLS. In addition, we support configuring Access logs for L4 agents in static files:

stream: enable_access_log: false # enable access log or not, default false access_log: logs/access_stream.log access_log_format: "$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received $session_time" # create your custom log format  by visiting http://nginx.org/en/docs/varindex.html access_log_format_escape: default # allows setting json or default characters escaping in variablesCopy the code

Update: Multi-language plug-ins continue to improve

WASM has a richer ecosystem

In previous releases, Apache APISIX has opened up support for the WASM ecosystem. In version 2.12.0, there are a number of new details for WASM ecology.

Apache APISIX already supports running WASM code at the Header_filter stage, compensating for the inability of existing external plug-ins to modify the response.

In addition, we support HTTP communication in WASM through the Apache APISIX host. With this functionality, we reimplemented the forward-auth plug-in with WASM as well. The plug-in functions almost exactly like the Lua version, even changing the name of the test case on the Lua version will pass.

The latest version of the Java Plugin Runner is available

Of course, we didn’t forget to update the existing external plug-ins. In version 2.12.0, Apache APISIX now allows external plug-ins to retrieve request bodies.

For example, the recently released Second version of the Java Plugin Runner includes this feature. The new version of the Java Plugin Runner also supports dynamic fetching of APISIX variables at run time.

For more details

In addition to the above new features and components, Apache APISIX version 2.12.0 has been updated with the following features:

  • Grpc-web support: After gRPC proxy, HTTP to gRPC, we welcome the third member of the gRPC family. Apache APISIX now also supports proxy gRPC Web protocol.
  • limit-countEnhancement: nowlimit-countThe plugin’s counters already support sharing between requests and routes, making them quite flexible.

For more details about Apache APISIX 2.12.0, see the Change log for this release.

download

To obtain the latest Version of Apache APISIX 2.12.0, download the following:

  • Source code: visit the download page
  • Binary installation package: Visit the installation guide