Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2020 01:51
What would you like to do?
server {
location / {
proxy_cache my_cache;
proxy_cache_lock on;
proxy_pass http://backend;
access_by_lua_block {
local token = ngx.var.arg_token or ngx.var.cookie_superstition
if token ~= "token" then
return ngx.exit(ngx.HTTP_FORBIDDEN)
ngx.header['Set-Cookie'] = {'superstition=token'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment