Welcome! Log In Create A New Profile

Advanced

Dynamic Cache in Nginx

August 07, 2012 04:23PM
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!!
Subject Author Posted

Dynamic Cache in Nginx

TiagoCruz August 07, 2012 04:23PM

Re: Dynamic Cache in Nginx

Maxim Dounin August 08, 2012 06:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 117
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready