Skip to content

Latest commit

 

History

History

pattern2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Pattern 2 - Envoy chaining/Envoy "sandwich"

This sample implements Envoy's external authorization filter to demonstrate simple routing of requests to upstream targets

Scenario

In this example, a client sends requests to an endpoints serviced by Envoy. The consumer passes a header (x-backend-name) with the name the name of the backend. Envoy calls the ext_authz service and dynamically routes the consumer to the appropriate backend.

Routing Sample

Testing via docker

Step 1: Build the docker image

./build-docker.sh

Test endpoint(s)

The request goes to Envoy on port 8080, which forwards the request to a Go application on port 7080. Custom processing can be performed here. The call is then forwarded to Envoy on port 9080 for final backend routing.

curl localhost:8080/httpbin -v

{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Content-Length": "0",
    "Host": "localhost",
    "User-Agent": "curl/7.72.0",
    "X-Amzn-Trace-Id": "Root=1-5f66d5bd-b781a4b0bc327988a65b5308",
    "X-Backend-Url": "default",
    "X-Envoy-Expected-Rq-Timeout-Ms": "15000",
    "X-Envoy-Original-Path": "/httpbin/get"
  },
  "origin": "xxxxx",
  "url": "https://localhost/get"
}

Cleanup

./clean-docker.sh