Memc_flags_to_last_modified and srcache , no 304 possible?

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 :slight_smile:

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

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:

On Tue, Apr 3, 2012 at 5:21 AM, Nginx_User777 [email protected]
wrote:

happy :slight_smile:

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

This is a TODO item for ngx_srcache. I’ll look into this in the near
future. Thanks for reminding me of this :slight_smile:

Best regards,
-agentzh

On Wed, Apr 4, 2012 at 11:23 AM, agentzh [email protected] wrote:

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

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

This is a TODO item for ngx_srcache. I’ll look into this in the near
future. Thanks for reminding me of this :slight_smile:

I’ve just committed a patch to ngx_srcache’s git master to add support
for conditional GET requests (for both If-Modified-Since and
If-Unmodified-Since):

https://github.com/agentzh/srcache-nginx-module/commit/1df1c56

I’ve also included some tests for this feature :slight_smile:

Enjoy!
-agentzh

Hi Agentzh,

Thanks for your answer.

I’ll continue to work with a srcache_fetch_skip to honor 304.

And a really big thanks for these excellent modules, it’s great !!!

Best Regards.

Posted at Nginx Forum:

You 're great !

I’ll test it quickly :wink:

Thanks for this and all others stuffs

Posted at Nginx Forum: