├── Dockerfile ├── README.md └── nginx.conf /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openresty/openresty:alpine 2 | 3 | EXPOSE 8080 4 | ADD nginx.conf /usr/local/openresty/nginx/conf/nginx.conf 5 | 6 | RUN chgrp -R 0 /usr/local/openresty/nginx/ && \ 7 | chmod -R g=u /usr/local/openresty/nginx/ 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nginx-echo-headers 2 | 3 | A simple tool for debugging HTTP requests. nginx will return all request headers and body to the client. 4 | 5 | For the Docker image, see https://hub.docker.com/r/brndnmtthws/nginx-echo-headers/ 6 | 7 | Try running it like so: 8 | 9 | ```ShellSession 10 | $ docker run -p 8080:8080 brndnmtthws/nginx-echo-headers 11 | Unable to find image 'brndnmtthws/nginx-echo-headers:latest' locally 12 | latest: Pulling from brndnmtthws/nginx-echo-headers 13 | 88286f41530e: Pull complete 14 | 7c2e0e2a8099: Pull complete 15 | fe86df227e07: Pull complete 16 | Digest: sha256:177eccf79ee22074a9285341ea61e0a7864023a0a40b115a693256984821328f 17 | Status: Downloaded newer image for brndnmtthws/nginx-echo-headers:latest 18 | 2019/01/24 13:55:52 [notice] 1#1: using the "epoll" event method 19 | 2019/01/24 13:55:52 [notice] 1#1: openresty/1.11.2.5 20 | 2019/01/24 13:55:52 [notice] 1#1: built by gcc 6.3.0 (Alpine 6.3.0) 21 | 2019/01/24 13:55:52 [notice] 1#1: OS: Linux 4.9.125-linuxkit 22 | 2019/01/24 13:55:52 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 23 | 2019/01/24 13:55:52 [notice] 1#1: start worker processes 24 | 2019/01/24 13:55:52 [notice] 1#1: start worker process 7 25 | 2019/01/24 13:56:02 [info] 7#7: *1 client 172.17.0.1 closed keepalive connection 26 | ``` 27 | 28 | Then test it (this example uses [httpie](https://httpie.org/)): 29 | 30 | ```ShellSession 31 | $ http localhost:8080 32 | HTTP/1.1 200 OK 33 | Connection: keep-alive 34 | Content-Type: text/plain 35 | Date: Thu, 24 Jan 2019 13:56:02 GMT 36 | Server: openresty/1.11.2.5 37 | Transfer-Encoding: chunked 38 | 39 | GET / HTTP/1.1 40 | Host: localhost:8080 41 | User-Agent: HTTPie/1.0.2 42 | Accept-Encoding: gzip, deflate 43 | Accept: */* 44 | Connection: keep-alive 45 | ``` 46 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | error_log stderr debug; 2 | 3 | events { 4 | worker_connections 1024; 5 | } 6 | 7 | http { 8 | access_log off; 9 | include mime.types; 10 | 11 | server { 12 | listen 8080; 13 | listen [::]:8080 ipv6only=on; 14 | location / { 15 | echo_duplicate 1 $echo_client_request_headers; 16 | echo "\r"; 17 | echo_read_request_body; 18 | echo $request_body; 19 | echo $hostname; 20 | } 21 | } 22 | } 23 | --------------------------------------------------------------------------------