https://github.com/kosprov/http-echo-server
A simple HTTP server that echoes whatever it receives
https://github.com/kosprov/http-echo-server
Last synced: 5 months ago
JSON representation
A simple HTTP server that echoes whatever it receives
- Host: GitHub
- URL: https://github.com/kosprov/http-echo-server
- Owner: kosprov
- License: apache-2.0
- Created: 2019-11-12T12:57:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-13T22:55:21.000Z (almost 3 years ago)
- Last Synced: 2023-08-04T15:12:14.900Z (almost 3 years ago)
- Language: Java
- Size: 25.4 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Welcome to the `http-echo-server` repository
`http-echo-server` is a tiny HTTP server based on GraalVM native-image and Jetty.
It is meant as a testing utility, for example when you test proxies or load balancers.
Keep in mind that whatever is echoed is after Jetty has parsed the request. There might be slight differences from the
echoed content to whatever was received on the wire (for example, the order of headers).
If you want a TCP echo server, you can use [`watson/http-echo-server`](https://github.com/watson/http-echo-server). The
downside is the 2 seconds delay before sending the response.
## How to use it
The easiest way is to use the pre-built Docker image:
docker run --rm -it -p 3000:3000 kosprov/http-echo-server
and then:
curl -vs http://localhost:3000/foo
To enable TLS, use:
docker run --rm -it -e TLS_PORT=3001 -p 3001:3001 kosprov/http-echo-server
This will use an internal certificate. If you want a different one, you can use variables `KEYSTORE`, `KEYSTORE_PASS`
and `KEY_PASS`. For example:
docker run --rm -it -e TLS_PORT=3001 -p 3001:3001
-v $(pwd)/keystore.p12:/tmp/keystore.p12 \
-e KEYSTORE=/tmp/keystore.p12 \
-e KEYSTORE_PASS=keystore-pass \
-e KEY_PASS=key-pass \
kosprov/http-echo-server