I'm using Nginx on CentOS 7. I want to add a cache control header for files that end in a particular extension or taht contain a "/image/" string in the URL. I tried this
location / {
proxy_pass http://scale; # match the name of upstream directive which is defined above
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($request_uri ~* ".(ico|gif|jpe?g|png)$") | ($request_uri ~* "/image/") {
expires 60d;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
break;
}
}
but upon restarting the server, I'm getting a
invalid condition "$request_uri" in /etc/nginx/conf.d/scale.conf:16
error. If I remove " | ($request_uri ~* "/image/")" from the problematic line, all restarts fine, but then I'm unable to match stuff that I want. How do I write a proper or statement in my configuration file?