Enchant Apache Traffic Server with mruby power.
APACHE-2.0 License
Enchant Apache Traffic Server with mruby power.
ts_mruby is an Apache Traffic Server plugin that provides more flexible and extensible server configuration. You can write the configuration by mruby, and use mrbgems modules. ... And maybe the plugin support common syntax as part of the mod_mruby and ngx_mruby.
See Wiki for more documents.
C++11
Apache Traffic Server >= 4.2.x with atscppapi
./configure --enable-cppapi
For example, you can write an ip filtering logic by using mruby like DSL:
whitelist = [
"127.0.0.1"
]
# deny if client IP is listed in whitelist
conn = ATS::Connection.new
unless whitelist.include?(conn.remote_ip)
ATS::echo "Your access is not allowed ..."
ATS::return ATS::HTTP_FORBIDDEN
end
$ docker pull syucream/ts_mruby
$ docker run -it syucream/ts_mruby /bin/bash
root@ad7a82be8a65:/opt# trafficserver start
root@ad7a82be8a65:/opt# curl http://localhost:8080/
ts_mruby test
$ brew install https://raw.githubusercontent.com/syucream/ts_mruby/master/Formula/trafficserver-atscppapi.rb
$ brew install --HEAD https://raw.githubusercontent.com/syucream/ts_mruby/master/Formula/ts_mruby.rb
Some components for mruby in this repository and sample scripts refer to mod_mruby and ngx_mruby's one under the MIT License.