0

I'm trying to unconditionally cache an upstream server that provides neither an Expires nor a Cache-Control header. I'm not managing...

Config:

proxy_cache_path /tmp/nginx keys_zone=motus_cache:2m max_size=1g
                 inactive=60m use_temp_path=off;

server {
        listen 8000 default_server;
        listen [::]:8000 default_server;
        server_name _;                  

        location / {                    
                proxy_cache motus_cache;     
                proxy_buffering on;
                proxy_pass https://motus.org;    
                proxy_ssl_name "motus.org";
                proxy_ssl_server_name on;
                proxy_ignore_headers "Set-Cookie" "Expires" "Cache-Control";                   
                proxy_hide_header Set-Cookie;            
                proxy_hide_header X-Powered-By;
        }

}

Sample request:

curl -o /dev/null 'http://localhost:8000/data/binary/tagVisits'

(takes about 7 seconds)

Headers from upstream server:

< HTTP/1.1 200 200                                                                                  
< Content-Type: application/octet-stream                                                            
< Server: Microsoft-IIS/8.5                                                                         
< Set-Cookie: JSESSIONID=FE61DA4E7BD4996C09FB2B6D5E40D8CF; Path=/; Secure; HttpOnly                 
< X-Powered-By: ASP.NET
< Date: Mon, 10 Oct 2022 20:12:18 GMT
< Content-Length: 2779146 
TvE
  • 1,016
  • 1
  • 11
  • 19

1 Answers1

0

Found the answer: I am missing a proxy_cache_valid header, e.g.:

proxy_cache_valid any 30m;
TvE
  • 1,016
  • 1
  • 11
  • 19