Welcome! Log In Create A New Profile

Advanced

How to use srcache_store while proxy_pass use to connect backend

March 05, 2012 12:48PM
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.
Subject Author Posted

How to use srcache_store while proxy_pass use to connect backend

n1xman March 05, 2012 12:48PM

Re: How to use srcache_store while proxy_pass use to connect backend

hira2 March 05, 2012 01:23PM

Re: How to use srcache_store while proxy_pass use to connect backend

agentzh March 06, 2012 08:28PM

Re: How to use srcache_store while proxy_pass use to connect backend

n1xman March 08, 2012 12:51AM

Re: How to use srcache_store while proxy_pass use to connect backend

agentzh March 08, 2012 01:04AM

Re: How to use srcache_store while proxy_pass use to connect backend

n1xman March 08, 2012 01:31AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 130
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready