Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top