1- [ ![ pulls] ( https://img.shields.io/docker/pulls/mendhak/http-https-echo.svg?style=for-the-badge&logo=docker )] ( https://hub.docker.com/r/mendhak/http-https-echo )
1+ [ ![ pulls] ( https://img.shields.io/docker/pulls/mendhak/http-https-echo.svg?style=for-the-badge&logo=docker )] ( https://hub.docker.com/r/mendhak/http-https-echo )
22[ ![ Docker Build Status] ( https://img.shields.io/docker/build/mendhak/http-https-echo?color=darkgreen&label=build&style=for-the-badge )
33![ Docker Image Version (latest semver)] ( https://img.shields.io/docker/v/mendhak/http-https-echo?color=lightblue&label=latest&sort=semver&style=for-the-badge )] ( https://hub.docker.com/r/mendhak/http-https-echo )
44
55
66
7- [ ` mendhak/http-https-echo ` ] ( https://hub.docker.com/r/mendhak/http-https-echo ) is a Docker image that can echo various HTTP request properties back to client, as well as in the Docker container logs.
8- You can use your own certificates, choose your ports, decode JWT headers and filter out certain paths.
7+ [ ` mendhak/http-https-echo ` ] ( https://hub.docker.com/r/mendhak/http-https-echo ) is a Docker image that can echo various HTTP request properties back to client, as well as in the Docker container logs.
8+ You can use your own certificates, choose your ports, decode JWT headers and filter out certain paths.
99
1010![ browser] ( https://raw.githubusercontent.com/mendhak/docker-http-https-echo/master/screenshots/screenshot.png )
1111
12+ This image is executed as non root by default and is fully compliant with Kubernetes or Openshift deployment.
13+
1214## Basic Usage
1315
1416Run with Docker
1517
16- docker run -p 8080:80 -p 8443:443 --rm -t mendhak/http-https-echo
18+ docker run -p 8080:8080 -p 8443:8443 --rm -t mendhak/http-https-echo
1719
1820Or run with Docker Compose
1921
@@ -26,9 +28,9 @@ Then, issue a request via your browser or curl, and watch the response, as well
2628
2729## Choose your ports
2830
29- You can choose a different internal port instead of 80 and 443 with the ` HTTP_PORT ` and ` HTTPS_PORT ` environment variables.
31+ You can choose a different internal port instead of 80 and 443 with the ` HTTP_PORT ` and ` HTTPS_PORT ` environment variables.
3032
31- In this example I'm setting http to listen on 8888, and https to listen on 9999.
33+ In this example I'm setting http to listen on 8888, and https to listen on 9999.
3234
3335 docker run -e HTTP_PORT=8888 -e HTTPS_PORT=9999 -p 8080:8888 -p 8443:9999 --rm -t mendhak/http-https-echo
3436
@@ -37,7 +39,7 @@ With docker compose, this would be:
3739
3840 my-http-listener:
3941 image: mendhak/http-https-echo
40- environment:
42+ environment:
4143 - HTTP_PORT=8888
4244 - HTTPS_PORT=9999
4345 ports:
@@ -52,8 +54,8 @@ Use volume mounting to substitute the certificate and private key with your own.
5254 my-http-listener:
5355 image: mendhak/http-https-echo
5456 ports:
55- - "8080:80 "
56- - "8443:443 "
57+ - "8080:8080 "
58+ - "8443:8443 "
5759 volumes:
5860 - /etc/ssl/certs/ssl-cert-snakeoil.pem:/app/fullchain.pem
5961 - /etc/ssl/private/ssl-cert-snakeoil.key:/app/privkey.pem
@@ -62,21 +64,21 @@ Use volume mounting to substitute the certificate and private key with your own.
6264
6365## Decode JWT header
6466
65- If you specify the header that contains the JWT, the echo output will contain the decoded JWT. Use the ` JWT_HEADER ` environment variable for this.
67+ If you specify the header that contains the JWT, the echo output will contain the decoded JWT. Use the ` JWT_HEADER ` environment variable for this.
6668
67- docker run -e JWT_HEADER=Authentication -p 8080:80 -p 8443:443 --rm -it mendhak/http-https-echo
69+ docker run -e JWT_HEADER=Authentication -p 8080:8080 -p 8443:8443 --rm -it mendhak/http-https-echo
6870
6971
7072Now make your request with ` Authentication: eyJ... ` header (it should also work with the ` Authentication: Bearer eyJ... ` schema too):
7173
7274 curl -k -H "Authentication: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" http://localhost:8080/
7375
74- And in the output you should see a ` jwt ` section.
76+ And in the output you should see a ` jwt ` section.
7577
7678## Do not log specific path
7779
78- Set the environment variable ` LOG_IGNORE_PATH ` to a path you would like to exclude from verbose logging to stdout.
79- This can help reduce noise from healthchecks in orchestration/infrastructure like Swarm, Kubernetes, ALBs, etc.
80+ Set the environment variable ` LOG_IGNORE_PATH ` to a path you would like to exclude from verbose logging to stdout.
81+ This can help reduce noise from healthchecks in orchestration/infrastructure like Swarm, Kubernetes, ALBs, etc.
8082
8183 docker run -e LOG_IGNORE_PATH=/ping -p 8080:80 -p 8443:443 --rm -t mendhak/http-https-echo
8284
@@ -88,19 +90,19 @@ With docker compose, this would be:
8890 environment:
8991 - LOG_IGNORE_PATH=/ping
9092 ports:
91- - "8080:80 "
92- - "8443:443 "
93+ - "8080:8080 "
94+ - "8443:8443 "
9395
9496
9597## JSON payloads and JSON output
9698
97- If you submit a JSON payload in the body of the request, with Content-Type: application/json, then the response will contain the escaped JSON as well.
99+ If you submit a JSON payload in the body of the request, with Content-Type: application/json, then the response will contain the escaped JSON as well.
98100
99101For example,
100102
101103 curl -X POST -H "Content-Type: application/json" -d '{"a":"b"}' http://localhost:8080/
102104
103- Will contain a ` json ` property in the response/output.
105+ Will contain a ` json ` property in the response/output.
104106
105107 ...
106108 "xhr": false,
@@ -110,16 +112,6 @@ Will contain a `json` property in the response/output.
110112 }
111113 }
112114
113- ## Run as a non-root or rootless user
114-
115- Set the ` --user ` to ` node ` , and change the internal ports to a high number.
116-
117- docker run --user node -e HTTP_PORT=8080 -e HTTPS_PORT=8443 -p 8080:8080 -p 8443:8443 --rm mendhak/http-https-echo
118-
119- Or use the sysctl flag, like so
120-
121- docker run --user node --sysctl net.ipv4.ip_unprivileged_port_start=0 -p 8080:80 -p 8443:443 --rm mendhak/http-https-echo
122-
123115## Output
124116
125117#### Curl output
@@ -136,6 +128,6 @@ Or use the sysctl flag, like so
136128
137129 docker build -t mendhak/http-https-echo .
138130
139- Run some tests to make sure features are working as expected.
131+ Run some tests to make sure features are working as expected.
140132
141133 ./tests.sh
0 commit comments