agentzh/srcache-nginx-module — Issue #13: memcached down
Author: TheRoSS
Created: 2012-03-06 11:08:18+00:00
State: open

Hi
If the memcached server is down the very strange output is generated and I have no idea to control it by the module. Expected behaviour is to pass request to proxy without cache requesting.

srcache version: 0.12rc5

Nginx conf:

upstream storage {
server localhost:8081;
}

upstream memcached {
server localhost:11211;
keepalive 512;
}

server {
# Get static content from storage (control center) via memcached caching
location /storage {
set $key $uri;
srcache_fetch GET /memc key=$key;
srcache_store PUT /memc key=$key;
proxy_pass http://storage;
}

location = /memc {
internal;
set $memc_key $arg_key;
set $memc_exptime 10;
memc_pass memcached;
}

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

Request:

curl -v http://localhost:8080/1001/1000/1.png

If memcached is up I have my .phg picture

If memcached is down the result is:

> GET /1001/1000/1.png HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> Host: localhost:8080
> Accept: */*
>
<html>
<head>
<title>The page is temporarily unavailable</title>
<style>
body { font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body bgcolor="white" text="black">
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
The page you are looking for is temporarily unavailable.<br/>
Please try again later.
</td>
</tr>
</table>
</body>
</html>
HTTP/1.1 200 OK
Server: nginx/1.0.4
Date: Tue, 06 Mar 2012 08:54:00 GMT
Content-Type: image/png
Connection: keep-alive
Last-Modified: Thu, 18 Nov 2010 14:37:40 GMT
ETag: "40000a6a-8ca-49554bb626c14"
Accept-Ranges: bytes
Content-Length: 2250

�PNG
...... picture data ......
<html>
<head>
<title>The page is temporarily unavailable</title>
<style>
body { font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body bgcolor="white" text="black">
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
The page you are looking for is temporarily unavailable.<br/>
Please try again later.
</td>
</tr>
</table>
</body>
</html>
* Connection #0 to host localhost left intact
* Closing connection #0