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

    1. $ curl -v localhost:8000
    2. Trying ::1...
    3. * TCP_NODELAY set
    4. * Connected to localhost (::1) port 8000 (#0)
    5. > GET / HTTP/1.1
    6. > Host: localhost:8000
    7. > User-Agent: curl/7.64.1
    8. > Accept: */*
    9. >
    10. < x-powered-by: Express
    11. < content-type: application/json; charset=utf-8
    12. < content-length: 544
    13. < date: Thu, 31 Oct 2019 03:13:24 GMT
    14. < x-envoy-upstream-service-time: 1
    15. < response-body-size: 544 <-- This is added to the response header by our Lua script. --<
    16. < server: envoy
    17. <
    18. {
    19. "path": "/",
    20. "headers": {
    21. "host": "localhost:8000",
    22. "user-agent": "curl/7.64.1",
    23. "accept": "*/*",
    24. "x-forwarded-proto": "http",
    25. "x-request-id": "a78fcce7-2d67-4eeb-890a-73eebb942a17",
    26. "x-envoy-expected-rq-timeout-ms": "15000",
    27. },
    28. "method": "GET",
    29. "body": "",
    30. "fresh": false,
    31. "hostname": "localhost",
    32. "ip": "::ffff:172.20.0.2",
    33. "ips": [],
    34. "protocol": "http",
    35. "query": {},
    36. "subdomains": [],
    37. "xhr": false,
    38. "os": {
    39. "hostname": "7ca39ead805a"
    40. }
    41. * Connection #0 to host localhost left intact