]> git.sven.stormbind.net Git - sven/scripts.git/blobdiff - nginx/set_cache_control.conf
nginx config to set cache-control response header based on a cc request header
[sven/scripts.git] / nginx / set_cache_control.conf
diff --git a/nginx/set_cache_control.conf b/nginx/set_cache_control.conf
new file mode 100644 (file)
index 0000000..a99c1fe
--- /dev/null
@@ -0,0 +1,12 @@
+location /cc {
+ default_type 'text/plain';
+ content_by_lua_block {
+  local cc=ngx.req.get_headers()["cc"]
+  if cc ~= nil then
+   ngx.header["cache-control"]=cc
+   ngx.say(cc)
+  else
+   ngx.say("moep - no cc header found")
+  end
+ }
+}
\ No newline at end of file