1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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