Skip to content

Use eval with redis2? #8

@mcorner

Description

@mcorner

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions