Set header based on memcached request - mod_eval

Peter Hinse loco at d0pefish.de
Fri Jun 3 18:55:54 MSD 2011


Hi all,

I try to set a HTTP header for a proxy request based on some variable I
get from memcached with the eval module:

location / {
  eval $role {
    set $memcached_key $cookie_sessionid;
    memcached_pass 127.0.0.1:11211;
  }
  proxy_pass http://1.2.3.4:80;
  proxy_set_header X-Role $role;
}

I can see the memcached request, however the HTTP requests to the nginx
server just hangs for some seconds and no proxy request is done to the
backend server.

Any ideas?

# nginx -V
nginx: nginx version: nginx/1.0.4
nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
nginx: TLS SNI support disabled
nginx: configure arguments: --user=nginx --group=nginx
--prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx
--with-http_secure_link_module --with-http_random_index_module
--with-http_ssl_module --with-http_realip_module
--with-http_addition_module --with-http_sub_module
--with-http_dav_module --with-http_flv_module
--with-http_gzip_static_module --with-http_stub_status_module
--with-http_perl_module --with-mail --with-mail_ssl_module
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables' --with-ipv6 --with-file-aio
--add-module=/home/compile/redhat/BUILD/nginx-1.0.4/nginx_eval_module-1.0.1

Regards,
	
	Peter



More information about the nginx mailing list