Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created April 12, 2020 13:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
-- counting how many requests a given ip did
local redis_client = redis_cluster:new(config)
local resp, err = redis_client:incr(ngx.var.remote_addr)
ngx.header['X-Request-Counter'] = resp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment