1- Docker image which echoes various HTTP request properties back to client, as well as in docker logs.
1+ Docker image which echoes various HTTP request properties back to client, as well as in the Docker container logs.
2+ You can use your own certificates, choose your ports, decode JWT headers and filter out certain paths
23
34![ browser] ( https://raw.githubusercontent.com/mendhak/docker-http-https-echo/master/screenshots/screenshot.png )
45
5- ## Usage
6+ ## Basic Usage
67
78Run with Docker
89
@@ -17,20 +18,6 @@ Then, issue a request via your browser or curl, and watch the response, as well
1718 curl -k -X PUT -H "Arbitrary:Header" -d aaa=bbb https://localhost:8443/hello-world
1819
1920
20- ## Use your own certificates
21-
22- You can substitute the certificate and private key with your own. This example uses the snakeoil cert.
23-
24- my-http-listener:
25- image: mendhak/http-https-echo
26- ports:
27- - "8080:80"
28- - "8443:443"
29- volumes:
30- - /etc/ssl/certs/ssl-cert-snakeoil.pem:/app/fullchain.pem
31- - /etc/ssl/private/ssl-cert-snakeoil.key:/app/privkey.pem
32-
33-
3421## Choose your ports
3522
3623You can choose a different internal port instead of 80 and 443 with the ` HTTP_PORT ` and ` HTTPS_PORT ` environment variables.
@@ -51,6 +38,35 @@ With docker compose, this would be:
5138 - "8080:8888"
5239 - "8443:9999"
5340
41+
42+ ## Use your own certificates
43+
44+ Use volume mounting to substitute the certificate and private key with your own. This example uses the snakeoil cert.
45+
46+ my-http-listener:
47+ image: mendhak/http-https-echo
48+ ports:
49+ - "8080:80"
50+ - "8443:443"
51+ volumes:
52+ - /etc/ssl/certs/ssl-cert-snakeoil.pem:/app/fullchain.pem
53+ - /etc/ssl/private/ssl-cert-snakeoil.key:/app/privkey.pem
54+
55+
56+
57+ ## Decode JWT header
58+
59+ 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.
60+
61+ docker run -e JWT_HEADER=Authentication -p 8080:80 -p 8443:443 --rm -it mendhak/http-https-echo
62+
63+
64+ Now make your request with ` Authentication: eyJ... ` header (it should also work with the ` Authentication: Bearer eyJ... ` schema too):
65+
66+ curl -k -H "Authentication: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" http://localhost:8080/
67+
68+ And in the output you should see a ` jwt ` section.
69+
5470## Do not log specific path
5571
5672Set the environment variable ` LOG_IGNORE_PATH ` to a path you would like to exclude from verbose logging to stdout.
0 commit comments