Nginx: bug using if in location, how do I rectify
- by Quintin Par
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?