Nginx: bug using if in location, how do I rectify
        Posted  
        
            by 
                Quintin Par
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Quintin Par
        
        
        
        Published on 2011-06-21T07:28:25Z
        Indexed on 
            2011/06/21
            8:24 UTC
        
        
        Read the original article
        Hit count: 254
        
nginx
I am using nginx in reverse proxy mode. In my server section I have this code to set expire and cache control of my static files.
     location ~* ^.+\.(css|js|png|gif)$ {
         access_log off;
         expires max;
         add_header Cache-Control public;
         if (!-f $request_filename) {
           proxy_pass  http://localhost:82;
         }
     }
This is quite obviously creating issues.
Can someone help me correct this code to use try_files or rewrite? 
© Server Fault or respective owner