There are some images in one site of mine which are hosted to a remote server.
I haven't figured out yet how to set Cache-Control
to remote sources.
For local files I'm using:
location ~* \.(jpg|jpe?g|gif|png|ico|cur|gz|svgz|mp4|ogg|ogv|webm|htc|css|js|otf|eot|svg|ttf|woff|woff2)(\?ver=[0-9.]+)?$ {
expires 1M;
add_header Access-Control-Allow-Origin '*';
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
}
Which is working great.
I tried to add a location block containing the remote location of the files following the same principle with the local file, say for example https://example.com/img/ but nginx didnt do anything. The purpose of all this is to increase site speed.
Any suggestions will be appreciated.