Question

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?

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top