nginx config utilizing inline lua to print all HTTP request header
authorSven Hoexter <sven@stormbind.net>
Sat, 1 Dec 2018 12:51:12 +0000 (13:51 +0100)
committerSven Hoexter <sven@stormbind.net>
Sat, 1 Dec 2018 12:51:12 +0000 (13:51 +0100)
prints out all HTTP request header as received by the nginx server

nginx/show_header.conf [new file with mode: 0644]

diff --git a/nginx/show_header.conf b/nginx/show_header.conf
new file mode 100644 (file)
index 0000000..c592ba1
--- /dev/null
@@ -0,0 +1,11 @@
+# output all HTTP header as received by nginx
+location /header {
+ default_type 'text/plain';
+ content_by_lua_block {
+  local myheads=ngx.req.get_headers()
+  for key in pairs(myheads) do
+   local outp="Header '" .. key .. "': " .. myheads[key]
+   ngx.say(outp)
+  end
+ }
+}