I have a php script that converts and saves a image thumbnail into a folder indicating its size.
For example by going to a url like 'http://website.com/thumbs/640x480/image.jpg' a thumbnail image would be created and saved in a folder that matches the url, so that next time the image is served statically. The php script uses the following location block:
location /thumbs/ {
try_files $uri /thumbs/index.php?r=$uri&$query_string;
}
What I would like to do is regenerate the thumbnail image if there is an query argument such as ?nocache=1
appended to the thumbnail url.
I think that you need something like this:
location /thumbs/ {
if ($arg_nocache) {
rewrite ^(.*)$ /thumbs/index.php?r=$uri&$query_string break;
}
try_files $uri /thumbs/index.php?r=$uri&$query_string;
}