How to disable proxy cache when query string is empty?
        Posted  
        
            by 
                chx
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by chx
        
        
        
        Published on 2014-08-19T10:13:23Z
        Indexed on 
            2014/08/20
            4:23 UTC
        
        
        Read the original article
        Hit count: 490
        
nginx
With nginx I have
server {
  listen 1.2.3.4:80
  proxy_cache_valid       200 302 5m;
  location /  {
    try_files $uri @upstream;
    root $root;
  }
}
When I go http://example.com/foobar it generates a redirect to http://example.com/foobar?filter_distance=50&... which is visitor dependent so I would like to not cache this redirect. I need to bypass cache when the query string is empty. I am a bit lost because location /foobar will match both.
© Server Fault or respective owner