WTF is a Web Tailoring Framework built on top of Nginx/OpenResty
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
wtf/core
LICENSE
README.md
wtf-0.2-1.rockspec

README.md

WTF

WTF is a Web Tailoring Framework built on top of Nginx/OpenResty.

Quick Start

Before install WTF you need OpenResty, lua-rocks and git installed. Please follow this guide to add OpenResty repo to your system.

To install packages in Debian-based system run:

$ sudo apt-get update
$ sudo apt-get install openresty luarocks git
  1. Install core framework with luarocks:
$ luarocks install wtf
  1. Install demo package containing action, plugin and solver:
$ luarocks install wtf-demo
  1. Clone demo policy repo to directory containing OpenResty configuration (i.e. /etc/openresty)
$ cd /etc/openresty
$ sudo git clone https://github.com/honeybot/wtf-demo-policy
  1. Set up WTF for your nginx.conf:
http {
    ...
    include wtf-demo-policy/nginx/bootstrap.conf;
    ...
    server {
        ...
        location / {
          set $wtf_policies "demo";
          include wtf-demo-policy/nginx/policy/proxy.conf;
          ...
        }
      ...
    }
    ...
}
  1. Restart OpenResty and test your deployment:
$ sudo service openresty restart
$ curl -s http://localhost:8080/ > /dev/null && tail -n 5 /usr/local/openresty/nginx/logs/error.log

You should see log records from WTF:

2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): First says: "Hello, world! This is direct action"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): Second says: "Hello, world! This is direct action"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): First says: "Hello, world! This action was postponed"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): Second says: "Hello, world! This action was postponed"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): First says: "Hello, world! This is a  solver". Second says: "Hello, world! This is a  solver"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"