Following the release of version 2.11.0, Apache will also bring you the first version with new features in 2022 during the upcoming Spring Festival.
New Feature: More Serverless Integrations
Remember that in the last release, Apache added support for Azure Function. This new version is also full of intention, adding support for more Serverless vendors in the feature set.
Users can now also combine AWS Lambda and Apache OpenWhisk in Apache to expose specific functions on the gateway.
New features: More Authentication Plugins
This new release also brings two new plugins that we've been waiting for: forward-auth
and opa
.
- The
forward-auth
plugin is similar to Traefik's plugin of the same name, which allows sending the information of the current request to an external service for authentication. - The
opa
plugin integrates with the well-known Open Policy Agent, which can perform complex authentication functions via OPA.
These two plugins will add to the authentication functionality of Apache , giving users richer and easier authentication operations.
New features: More Logging Features
In addition to the authentication plugins mentioned above, this new release will also bring three new logging plugins: google-cloud-logging
, splunk-hec-logging
and rocketmq-logger
.
In the future, Apache will connect to more and more logging service providers and open source brokers to make logging easier.
Support for logging response bodies
The 2.12.0 release also supports logging of response bodies at the logging level. As with other Apache features, this feature can be enabled dynamically via expressions. This makes it possible to log only when a specific Content-Type and Content-Length is returned upstream, without having to worry about the problems associated with full response body collection.
An example 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"}
The above configuration will log 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 now supports registration of custom variables. Combined with 's custom logging format, it is possible to fully customize the reported log content. This means that log generation and reporting can be decoupled without modifying specific logging plugins. Here is a simple demonstration with an example.
For example, we can register a variable a6_route_labels in our own plug-in.
local core = require ".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 nilend)
And use it in a custom log format.
{ "log_format": { "host": "$host", "labels": "$a6_route_labels", "client_ip": "$remote_addr" }}
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"}
Eventually you will receive the log as shown below.
{"client_ip":"127.0.0.1","host":"localhost","labels":{"k":"v"},"route_id":"1"}
New: L4 Proxy Support for TLS over TCP Upstream
With the new Upstream Scheme introduced in version 2.12.0, Apache now supports proxying to TLS over TCP.
See below for details, just specify Scheme as TLS in the Upstream configuration.
{ "scheme": "tls", "nodes": { "127.0.0.1:1995": 1 }, "type": "roundrobin"}
The TCP proxy feature of Apache is now fully supported by TLS. In addition, we also support configuring the Access Log of the L4 proxy in a static file.
stream: enable_access_log: false # enable access log or not, default false access_log: logs/access_stream.log access_log_format: "<span class="token st