Skip to content

Instantly share code, notes, and snippets.

@fbettag
Created January 3, 2011 23:55
Show Gist options
  • Save fbettag/764201 to your computer and use it in GitHub Desktop.
Save fbettag/764201 to your computer and use it in GitHub Desktop.
nginx.conf redis
location /redis {
internal;
redis2_query get $request_uri;
set_unescape_uri $query $arg_query;
redis2_raw_query $query;
redis2_pass 127.0.0.1:6379;
}
location / {
content_by_lua '
local res = ngx.location.capture("/redis",
{ args = { query = "$request_uri\\r\\n" } }
)
local href = string.gsub(res.body, "\$[0-9]+\\r\\n", "");
ngx.redirect(href);
';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment