1

I'm looking at setting up a Redis cache to speed up a Ruby on Rails application deployed with nginx. I want nginx to send a 304 Not Modified either based on a timestamp in the Redis db (e.g. last modified), or based on the existence of a key. The only thing I found so far is how to cache full pages in Redis, like the following example from the HttpRedis module:

server {
  location / {
    set $redis_key $uri;

    redis_pass     name:6379;
    default_type   text/html;
    error_page     404 = /fallback;
  }

  location = /fallback {
    proxy_pass backend;
  }
}

Does anyone know if this is possible? Or would you recommend another way to send 304 responses without going to the Rails stack?

Alpha Hydrae
  • 2,891
  • 6
  • 26
  • 24

1 Answers1

0

You should be able to do this with the HttpRedis2Module and the HttpLuaModule.

Linus Thiel
  • 38,647
  • 9
  • 109
  • 104
  • Thanks, that definitely looks like it would work. Unfortunately, I guess that also means compiling my nginx from source. I'll see if it works. – Alpha Hydrae Sep 06 '12 at 15:21