Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created April 12, 2020 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandromoreira/5bc08d518b5d1cac8fb29e74f3334015 to your computer and use it in GitHub Desktop.
Save leandromoreira/5bc08d518b5d1cac8fb29e74f3334015 to your computer and use it in GitHub Desktop.
-- 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