memc_flags_to_last_modified and srcache , no 304 possible ?

Nginx_User777 nginx-forum at nginx.us
Mon Apr 2 21:21:39 UTC 2012


Hello All, 

Is it possible to use the memc_flags_to_last_modified directive with
srcache ? 
It doesn't work for me. 

When a browser request nginx with a "If-Modified-Since" header, I would
like that nginx lookup in memcached to verify if the "Last Modified" is
the same and honor the 304 request without hit the proxied server (in
another country). 

Impossible to get a 304, so no bandwith saved ... But my provider is
happy :) 

Thanks for your help ! 
I working on for several days, i'll really go mad :) 


My config: 

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  0;
    server_tokens           off;

    upstream memc1 {
        server XX.XX.XX.XX:11211;
        server unix:/tmp/memcached.sock backup;
        keepalive 1024;
    }
    upstream memc2 {
        server XX.XX.XX.XX:11211;
        keepalive 1024;
    }
    upstream_list MemCluster memc1 memc2;

access_log  /var/log/nginx/access.log;

    server {
        listen       80;
        server_name  localhost;
        
     location = /memc {
            internal;

        set $memc_key $query_string;
        set $memc_exptime 0;
        set_hashed_upstream $backend MemCluster $memc_key;
        memc_pass $backend;
        memc_flags_to_last_modified on;
        }

        location / {
            set $key $uri;
            srcache_fetch GET /memc $key;
            srcache_store PUT /memc $key;

            proxy_pass http://the-far-far-away-server;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}


Regards

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



More information about the nginx mailing list