Crates.io | cblt |
lib.rs | cblt |
version | 0.5.2 |
source | src |
created_at | 2024-11-08 10:13:39.450463 |
updated_at | 2024-12-01 17:20:18.402072 |
description | Safe and fast minimalistic web server, written in Rust, that serves files from a directory and proxies requests to another server. |
homepage | |
repository | https://github.com/evgenyigumnov/cblt |
max_upload_size | |
id | 1441046 |
size | 221,705 |
Safe and fast minimalistic web server, written in Rust, that serves files from a directory and proxies requests to another server.
The name Cblt appears to be a good shortened version of Cobalt. It retains the association with the element and strength, while also looking modern and minimalist.
You can run Cblt with Cargo or Docker.
Install:
cargo install cblt
Run:
cblt
docker run -d -p 80:80 -p 443:443 --restart unless-stopped --name cblt ievkz/cblt
Volumes:
-v /your/path/Cbltfile:/cblt/etc/Cbltfile # Cbltfile configuration if you would like to replace default config
-v /your/path/assets:/cblt/assets # Folder with your static content (index.html and etc)
curl -H "Host: example.com" http://127.0.0.1/
curl --insecure https:/127.0.0.1/
curl -X POST http://127.0.0.1/api/entry \
-H "User-Agent: curl/7.68.0" \
-H "Accept: */*" \
-H "Content-Type: application/json" \
-d '{"key":"value"}'
curl -v -H "Range: bytes=0-499" http://127.0.0.1/logo.png
"*:80" {
root "*" "/path/to/folder"
file_server
}
"127.0.0.1:8080" {
reverse_proxy "/test-api/*" "http://10.8.0.3:80"
root "*" "/path/to/folder"
file_server
}
"example.com" {
root "*" "/path/to/folder"
file_server
tls "/path/to/your/domain.crt" "/path/to/your/domain.key"
}
"*:80" {
redir "https://127.0.0.1{uri}"
}
"*:80" {
reverse_proxy "/http/*" "http://127.0.0.1:8080" "http://127.0.0.1:8081" {
lb_interval "60s"
lb_timeout "1s"
lb_retries "2"
lb_policy "round_robin" // "ip_hash"
}
root "*" "./assets"
file_server
}
Do test with Apache Benchmark (ab) for 3000 requests with 1000 concurrent connections. Download 23kb image from 127.0.0.1/logo.png
ab -c 1000 -n 3000 http://127.0.0.1/logo.png
Percent | Cblt | Nginx |
---|---|---|
50% | 179 | 1209 |
75% | 194 | 1655 |
100% | 200 | 2146 |
I would love to see contributions from the community. If you experience bugs, feel free to open an issue. If you would like to implement a new feature or bug fix, please follow the steps: