add nginx script to reply with arbitrary return codes
authorSven Höxter <sven.hoexter@rewe-digital.com>
Thu, 7 Mar 2019 15:51:37 +0000 (16:51 +0100)
committerSven Höxter <sven.hoexter@rewe-digital.com>
Thu, 7 Mar 2019 15:51:37 +0000 (16:51 +0100)
nginx/set_status_code.conf [new file with mode: 0644]

diff --git a/nginx/set_status_code.conf b/nginx/set_status_code.conf
new file mode 100644 (file)
index 0000000..4dadbab
--- /dev/null
@@ -0,0 +1,8 @@
+location ~ ^/sc/([0-9]+) {
+ default_type 'text/plain';
+ set $sc $1;
+  content_by_lua_block {
+   ngx.status=ngx.var.sc
+   ngx.say("Status code requested: ", ngx.var.sc)
+  }
+}
\ No newline at end of file