Created
April 12, 2020 01:51
-
-
Save leandromoreira/11b4b3cf5f41c5a96d2b981b24c610c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
else | |
ngx.header['Set-Cookie'] = {'superstition=token'} | |
end | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment