Welcome! Log In Create A New Profile

Advanced

can't cache javascript file from proxy

August 07, 2015 07:12AM
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
Subject Author Posted

can't cache javascript file from proxy

bugster86 August 07, 2015 07:12AM

Re: can't cache javascript file from proxy

Maxim Dounin August 07, 2015 02:20PM

Re: can't cache javascript file from proxy

bugster86 August 08, 2015 07:35AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready