using $upstream* variables inside map directive
    unoobee 
    nginx-forum at forum.nginx.org
       
    Thu Nov 12 09:58:31 UTC 2020
    
    
  
My configuration looks like this:
proxy_cache_path /cache/ssd              keys_zone=ssd_cache:10m levels=1:2
inactive=600s max_size=100m;
proxy_cache_path /cache/hdd              keys_zone=hdd_cache:10m levels=1:2
inactive=600s max_size=100m;
upstream backend {
        server www.test.com:443;
}
server {
    listen 80;
    server_name test.com;
        
        location / {
            proxy_pass https://backend;
            proxy_redirect https://backend/ /;
            proxy_set_header Host $host;
            proxy_cache $cache;
        }
}
map $upstream_http_content_length $cache  {
       volatile;
        ~^\d\d\b    ssd_cache;
        default     hdd_cache;
}
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,249880,289965#msg-289965
    
    
More information about the nginx
mailing list