https://github.com/jjeffcaii/capybara
A modern reverse proxy in Rust.
https://github.com/jjeffcaii/capybara
envoy nginx reverse-proxy rust
Last synced: about 1 year ago
JSON representation
A modern reverse proxy in Rust.
- Host: GitHub
- URL: https://github.com/jjeffcaii/capybara
- Owner: jjeffcaii
- License: apache-2.0
- Created: 2024-06-14T07:10:13.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-30T15:03:53.000Z (over 1 year ago)
- Last Synced: 2025-04-02T12:50:53.679Z (about 1 year ago)
- Topics: envoy, nginx, reverse-proxy, rust
- Language: Rust
- Homepage:
- Size: 319 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Capybara

[](https://app.codecov.io/gh/jjeffcaii/capybara)
[](https://crates.io/crates/capybara-bin)
[](https://crates.io/crates/capybara-bin)


A reverse proxy in Rust, which is inspired from Nginx/OpenResty/Envoy.
> WARNING: still in an active development!!!
## Quick Start
- Prepare Bootstrap YAML
```yaml
loggers:
main:
path: ~/capybara/logs/main.log
providers:
- kind: static_file
props:
path: /your/path/config.yaml
```
- Prepare config YAML
```yaml
listeners:
httpbin:
listen: 0.0.0.0:80
protocol:
name: http
props:
client_header_timeout: 30s
pipelines:
- name: capybara.pipelines.http.lua
props:
# write lua script
content: |
local cnts = 0
function handle_request_line(ctx,request_line)
-- set the upstream here, which links to 'upstreams.httpbin':
ctx:set_upstream('upstream://httpbin')
end
function handle_status_line(ctx,status_line)
ctx:replace_header('X-Powered-By','capybara')
-- set a custom response header which counts the requests:
cnts = cnts + 1
ctx:replace_header('X-Capybara-Requests', tostring(cnts))
end
upstreams:
httpbin:
transport: tcp
resolver: default
balancer: weighted
endpoints:
- addr: httpbin.org:443
weight: 70
- addr: postman-echo.com:443
weight: 30
```
- Run & Test
```shell
$ cargo run --bin capybara -- run -c bootstrap.yaml
$ curl -i http://localhost/get
```