Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jjeffcaii/capybara
A modern reverse proxy in Rust.
https://github.com/jjeffcaii/capybara
envoy nginx reverse-proxy rust
Last synced: 2 months 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 (7 months ago)
- Default Branch: master
- Last Pushed: 2024-08-05T15:36:02.000Z (5 months ago)
- Last Synced: 2024-08-05T18:23:03.312Z (5 months ago)
- Topics: envoy, nginx, reverse-proxy, rust
- Language: Rust
- Homepage:
- Size: 242 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Capybara
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/jjeffcaii/capybara/rust.yml)
[![Codecov](https://img.shields.io/codecov/c/github/jjeffcaii/capybara)](https://app.codecov.io/gh/jjeffcaii/capybara)
![GitHub Tag](https://img.shields.io/github/v/tag/jjeffcaii/capybara)
![GitHub License](https://img.shields.io/github/license/jjeffcaii/capybara)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.logproviders:
- 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 = 0function handle_request_line(ctx,request_line)
-- set the upstream here, which links to 'upstreams.httpbin':
ctx:set_upstream('upstream://httpbin')
endfunction 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))
endupstreams:
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
```