atom feed6 messages in ru.sysoev.nginxHow to use srcache_store while proxy_...
FromSent OnAttachments
n1xmanMar 5, 2012 9:47 am 
hira2Mar 5, 2012 10:22 am 
agentzhMar 6, 2012 5:26 pm 
n1xmanMar 7, 2012 9:50 pm 
agentzhMar 7, 2012 10:01 pm 
n1xmanMar 7, 2012 10:30 pm 
Subject:How to use srcache_store while proxy_pass use to connect backend
From:n1xman (ngin@nginx.us)
Date:Mar 5, 2012 9:47:21 am
List:ru.sysoev.nginx

Hi,

I can't store data while I'm using proxy_pass to connect to the backend if we can't find data on the memcached. srcache_fetch probes the memcached but since no data, it connect to the backend and get the correct data but not executing the srcache_store. Here is my config.

location /memc { internal; memc_connect_timeout 500ms; # 500 miliseconds memc_send_timeout 5000ms; # 5 seconds memc_read_timeout 500ms; # 500 miliseconds

set $memc_key $query_string; set $memc_exptime 3600;

memc_pass 127.0.0.1:11211; }

location /webservice { set $key $http_host$request_uri; srcache_fetch GET /memc $key; add_header X-Cached-From srcache-memcached;

# store the content! srcache_store_statuses 200 201 301 302 404 503 502; srcache_store PUT /memc $key;

# if it is not found we go to the backend proxy_pass http://remoteserver; }

I use nginx-1.0.10. and I should be able to use proxy_pass to get backend data while store data on the cache..?

If I comment the proxy_pass, srcache_store triggered and stored the 502 status page as it can't connect to the backend.

Please help me on how to use srcache_store and use proxy_pass to store data and connect to backend.

Thanks in advance.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,223438,223438#msg-223438