Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use eval with redis2? #8

Open
mcorner opened this issue Dec 28, 2010 · 3 comments
Open

Use eval with redis2? #8

mcorner opened this issue Dec 28, 2010 · 3 comments

Comments

@mcorner
Copy link

mcorner commented Dec 28, 2010

I am trying to use eval with the redis2 nginx plugin. I want to get the backend server name from redis.

I am trying with this:

location / {

eval_escalate on;

eval $answer {
redis2_raw_query 'get server_name\r\n';
eval_override_content_type text/plain;

redis2_query get server_name;

redis2_pass 127.0.0.1:6379;
}
proxy_pass $answer;

But that doesn't work because the redis response has the string length at the beginning of the response. So you get:

2010/12/28 17:05:34 [error] 52979#0: *73 invalid URL prefix in "$24
http://127.0.0.1/foo//" while sending to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

Any ideas?

@vkholodkov
Copy link
Owner

You better talk to the author of redis2 module.

@jnbdz
Copy link

jnbdz commented May 15, 2013

@mcorner have you been able to make it work with Redis2?

@jnbdz
Copy link

jnbdz commented May 17, 2013

I was able to make it work with http://wiki.nginx.org/HttpRedis

Here is my config:

location = /session {
eval_escalate on;
eval $session {
set $redis_key $cookie_session;
redis_pass [...]:6379;
}

echo $session;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants