Dynamic Cache in Nginx

TiagoCruz nginx-forum at nginx.us
Tue Aug 7 20:23:25 UTC 2012


Hello guys,

I'm trying to set some Expires in a lot of JavaScript that I got here,
but they are not static on filesystem, it is dynamic generated by a Java
application.

If I do this:

===================
  location /bla {
    root /tmp;
    expires 30m;
    }
===================

And put some .js files inside /tmp/bla everything works fine.

But when I try to do this:

===================
 location /script {
   expires 30m;
    proxy_cache             cache;
    proxy_pass              http://localhost:8080;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        Host $http_host;
  }
===================

Does not work. The reply from the server is always 200, never 304  as it
should be.

What can I do to fix this? 

I also tried to use nginx 1.3.3 with Etag support, but also only works
with static files :(

Thanks!!

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



More information about the nginx mailing list