Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/szuecs/skipper-example-proxy
- Owner: szuecs
- Created: 2022-06-20T14:07:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T19:02:45.000Z (over 1 year ago)
- Last Synced: 2024-10-31T10:12:42.060Z (about 2 months ago)
- Language: Go
- Size: 18.7 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```