Lua Filter
The following documentation runs through the setup of both services.
Step 1: Install Docker
A simple way to achieve this is via the Docker Desktop.
Step 2: Clone the Envoy repo and start all of our containers
Terminal 1
Step 3: Send a request to the service
Terminal 1
$ curl -v localhost:8000
Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8000 (#0)
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.64.1
> Accept: */*
>
< x-powered-by: Express
< content-type: application/json; charset=utf-8
< content-length: 544
< date: Thu, 31 Oct 2019 03:13:24 GMT
< x-envoy-upstream-service-time: 1
< response-body-size: 544 <-- This is added to the response header by our Lua script. --<
< server: envoy
<
{
"path": "/",
"headers": {
"host": "localhost:8000",
"user-agent": "curl/7.64.1",
"accept": "*/*",
"x-forwarded-proto": "http",
"x-request-id": "a78fcce7-2d67-4eeb-890a-73eebb942a17",
"x-envoy-expected-rq-timeout-ms": "15000",
},
"method": "GET",
"body": "",
"fresh": false,
"hostname": "localhost",
"ip": "::ffff:172.20.0.2",
"ips": [],
"protocol": "http",
"query": {},
"subdomains": [],
"xhr": false,
"os": {
"hostname": "7ca39ead805a"
}
* Connection #0 to host localhost left intact