Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/szuecs/skipper-example-proxy

Example skipper with a custom filter
https://github.com/szuecs/skipper-example-proxy

Last synced: 4 days ago
JSON representation

Example skipper with a custom filter

Awesome Lists containing this project

README

        

Library Docs https://opensource.zalando.com/skipper

## Build

Fetch newest skipper library.

```
% go get github.com/zalando/skipper
go: downloading github.com/zalando/skipper v0.16.117
...
```

Build your custom skipper

```
% make
mkdir -p bin
go build -ldflags "-X main.version=6665329 -X main.commit=6665329" -o bin/skipper .
```

## Add filter

[custom Filter code](./filters/custom.go)

## Run

Run your customer skipper with `myFilter()`.

```
% ./bin/skipper -inline-routes='* -> myFilter() -> status(200) -> '
[APP]INFO[0000] Expose metrics in codahale format
[APP]INFO[0000] support listener on :9911
[APP]INFO[0000] proxy listener on :9090
[APP]INFO[0000] TLS settings not found, defaulting to HTTP
[APP]INFO[0000] route settings, reset, route: : * -> myFilter() -> status(200) -> <--- custom filter loaded
[APP]INFO[0000] route settings received
[APP]INFO[0000] route settings applied
::1 - - [20/Jun/2022:15:45:07 +0200] "GET /goo HTTP/1.1" 200 0 "-" "curl/7.49.0" 0 localhost:9090 - -
^C

% curl localhost:9090/foo -v
* Trying ::1...
* Connected to localhost (::1) port 9090 (#0)
> GET /foo HTTP/1.1
> Host: localhost:9090
> User-Agent: curl/7.49.0
> Accept: */*
>
< HTTP/1.1 200 OK
< My-Filter: response <-------- our response filter
< Server: Skipper
< Date: Mon, 20 Jun 2022 13:45:07 GMT
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
```