can't cache javascript file from proxy

bugster86 nginx-forum at nginx.us
Fri Aug 7 11:12:21 UTC 2015


Hi,

I have a problem with cache javascript file from a proxy glassfish4.0
Server.

My nginx.conf is this:

___________________________
user                    nginx nginx;
error_log               /var/log/nginx/error.log warn;
pid                     /usr/local/nginx/logs/nginx_1.8.0.pid;
worker_processes        auto;
worker_rlimit_nofile    1024;
worker_priority         -5;
worker_cpu_affinity     01 10;


events {

        worker_connections 128;
        multi_accept    on;
        use epoll;
        #debug_connection 127.0.0.1;
        debug_connection 10.77.37.133;
}

________________________________

And this is my specific site conf file
http {

        include                 /etc/nginx/mime.types;
        default_type            application/octet-stream;
        sendfile                on;
        tcp_nopush              on;
        keepalive_timeout       65;
        reset_timedout_connection       on;
        log_not_found           off;
        proxy_cache_path /tmp/nginx/cache keys_zone=cache1:10m;
        proxy_cache_valid 200 302 8h;

        server {

                listen          81;
                server_name     r60;
                root    /var/nginx/first/html;

                set $cache_key "$request_uri";


                location        / {

                        index   index.html index.htm;

                }


               

                error_page      500 502 503 504 /50x.html;
                error_page      404 =200 /50x.html;
                error_page      403 =200 /50x.html;
                location = /50x.html {
                        root html;
                }

                location /site
                {
                        location ~* \.(js)$
                        {
                        proxy_cache     cache1;
                        proxy_cache_key $cache_key;
                        proxy_ignore_headers "Cache-Control";
                        #proxy_ignore_headers "Pragma";
                        proxy_hide_header Cache-Control;
                        proxy_hide_header Pragma;
                        add_header X-Proxy-Cache $upstream_cache_status;
                        proxy_pass http://10.77.38.166:8080;
                        }

                        proxy_pass http://10.77.38.166:8080;
                }

              


        }

}
______________________________________________________
I have no problem in configuration sintax (nginx -t --> OK)

With a browser, I open a web page http://r60:81/site and I see all the
content of the page.
This is OK but I don't view anything in /tmp/nginx/cache  (no  cache files
)

My web request download 3 javascript file.
I expect it to be cached.


Why proxy_ignore_headers "Cache-Control" doesn't work properly?

Thanks in advace

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



More information about the nginx mailing list