Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#418 closed defect (worksforme)

memcached module returns a code 000 instead of the code 200

Reported by: sasha Owned by:
Priority: major Milestone:
Component: nginx-module Version:
Keywords: memcached module return Cc:
uname -a: Linux 2.6.18-348.16.1.el5.centos.plus #1 SMP Wed Aug 21 04:04:49 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-54)
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 --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --with-http_realip_module --with-http_addition_module --with-http_gzip_static_module --with-http_degradation_module --with-http_stub_status_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E

Description

memcached module returns a code 000 instead of the code 200

Change History (5)

comment:1 by Maxim Dounin, 10 years ago

Resolution: worksforme
Status: newclosed

Works fine here. If you have problems, please provide more details.

comment:2 by sasha, 10 years ago

Memcached module when the request is successful, it returns the code 000, not code 200

comment:3 by Maxim Dounin, 10 years ago

Again, works fine here. If you have problems, please provide more details. Steps to reproduce the problem, relevant configuration files and a transcript which shows the problem may help.

comment:4 by sasha, 10 years ago

if ($request_method = GET) {
set $memcached_key "$host$request_uri";
memcached_pass localhost:11211;
add_header Content-Type "text/html; charset=UTF-8";
error_page 403 404 405 500 502 504 = @fallback;

set $mav_md5_for_memcached_pass_status $status;
}

if ( $mav_md5_for_memcached_pass_status != 000 ) {
 		proxy_pass http://localhost:8080;
}

so it should not work properly, but it works as a will be parameter $ mav_md5_for_memcached_pass_status equal to 200

Last edited 10 years ago by sasha (previous) (diff)

comment:5 by Maxim Dounin, 10 years ago

The $status variable is only available once a response was sent. It's not something you can use in rewrite module checks, as it's not yet available during execution of rewrite directives. See rewrite module docs for details.

If you want nginx to talk to memcached, and if a request fails - to talk to a http backend instead, you should use error_page-based fallback instead.

Note: See TracTickets for help on using tickets.