A lightweight web server built in Rust using Actix-Web and Clap for command-line argument parsing.
It is designed for testing and experimenting with simple server behaviors.
It can run in two modes:
- echo → echoes the request path, headers, method, scheme and host.
- static → always returns a fixed text.
Logging is configurable, and the server can be containerized and deployed for some architectures.
- Two execution modes:
echo→ returns request path, headers, and metadata.static→ returns a static text configured at startup.
- Configurable log level (
off,error,warn,info,debug,trace). - Customizable host and port.
- Built with Actix-Web → high-performance async web server.
- Lightweight Docker image with multi-architecture support (
amd64,arm,ppc64le, etc.).
Usage: myapp [OPTIONS]
Options:
--mode <MODE> Execution mode (echo, static) [default: echo]
--log-level <LOG_LEVEL> Log level of the server (off, error, warn, info, debug, trace) [default: info]
--static-text <TEXT> Text returned by the server if execution mode is static [default: "Hello World!"]
--host <HOST> Server host [default: 0.0.0.0]
--port <PORT> Server port [default: 8080]
-V, --version Print version
-h, --help Print helpcargo build --releasehttp-echo --mode static --static-text "Hi from Rust" --port 8080Static mode:
http-echo --mode static --static-text "Hello World" --port 8080curl http://localhost:8080/Response:
Hello World!
Echo mode:
http-echo --mode echo --port 8080curl -H "X-Custom: test" http://localhost:8080/helloResponse:
{
"headers": {
"accept":"*/*",
"host":"localhost:8080",
"user-agent":"curl/8.7.1",
"x-custom":"test"
},
"host":"localhost:8080",
"method":"GET",
"path":"/hello",
"scheme":"http"
}docker run -p 8080:8080 giwiro/http-echo:latest --mode static --static-text "Hello World" --port 8080docker run -p 8080:8080 giwiro/http-echo:latest --mode echo --port 8080MIT License. See LICENSE for details.