test cache control contain s-maxage

Discussion in 'Nginx' started by wkharrat, Apr 25, 2017.

  1. #2
    Hi,
    i want to cache response only if Cache-Control contain "s-maxage" i add this map:

    map $upstream_http_cache_control $no_cache {
         default 1;
         "~*s-maxage" 0;
    
    }
    Code (ApacheConf):
    in the location :
    location ~* "\.(html)$" {
                   proxy_pass  http://prod;
              proxy_set_header Host $http_host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
    
                   include /etc/nginx/conf.d/shared/cache_html.conf;
    }
    Code (ApacheConf):
    in the cache conf:
    
    proxy_cache_methods GET ;
    proxy_cache_valid any 48h;
    proxy_no_cache       $no_cache;
    Code (ApacheConf):
    but this not work...
     
    Last edited: Apr 25, 2017
    wkharrat, Apr 25, 2017 IP