This repository demonstrates how to use Envoy proxy with an external authorization service.
To install the project, follow these steps:
-
Clone the repository:
git clone https://github.com/ferencsarai/envoy-auth
-
Change into the project directory:
cd envoy-auth
-
Build the project using Docker Compose:
docker-compose build
-
To run the project, use the following command:
docker-compose up
Once the project is running, you can send requests to http://localhost:8000
with the User-Agent: Chrome
header to get a successful response. Requests with any other User-Agent
header will result in a 403
status code.
-
Not allowed (403):
curl -v -A "sfjs" http://localhost:8000
-
Allowed (200) - this will return a response from the echo service http-echo:
curl -v -A "Chrome" http://localhost:8000
The project utilizes three containers from the docker-compose file.
- The client sends a request to Envoy proxy.
- Envoy proxy forwards the request to the external authorization service.
- The external authorization service checks the
User-Agent
header.- If the
User-Agent
containsChrome
, it returns200
. - If the
User-Agent
does not containChrome
, it returns403
.
- If the
- Envoy proxy forwards the request to the service if
200
is returned. Otherwise, it returns403
to the client without forwarding the request to the service.
Envoy proxy configuration: envoy.yaml