Reputation: 21
I am using nginx 1.0.12 and have a setup like this:
location /protected/ {
expires 30d;
log_not_found off;
internal;
alias /var/www/files/uploads/;
}
and am requesting user files like this:
header('X-Accel-Redirect: http://example.com/adetwiler/files/example.png');
header('Content-type: image/png');
Everything works great up until the point where the user can rotate their image. Once they rotate their image, I can't figure out how to get the "new" version of the file, it's still showing the older version of the image, unless "refresh" is clicked on the browser.
I have tried to set Cache-control: no-cache, Expires: Expires: Sat, 26 Jul 1997 05:00:00 GMT, no luck with those.
I tried adding the modified date like so:
header('X-Accel-Redirect: http://example.com/adetwiler/files/example.png?123456789');
That caused the image to load everytime when I tried that.
I tried adding this to the nginx config:
add_header Pragma public;
add_header Cache-Control "public, must-revalidate";
At this point I am at a loss, I have tried everything that I could think of.
So my question is, is there a way with my current setup or something similar to my setup to use the newer version of the image once the image is updated?
Thanks!
Upvotes: 2
Views: 2082
Reputation: 2971
It looks like setting X-Accel-Buffering: no
as a header tells nginx not to cache the response at all.
https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/
Upvotes: 1