Hi,
We need to cache images while reverse proxy with the following
settings.
location /foo {
proxy_pass http://www.example.com/foo;
proxy_set_header X-Real-IP $remote_addr;
if ($request_uri ~* \.(jpg|gif)$) {
expires 60d;
add_header Cache-Control private;
}
....
This is working if we use it without reverse proxy. I have tried
$upstream_http_request_uri with no luck.
I have tried the following as well.
location /foo/images {
proxy_pass http://www.example.com;
expires 60d;
add_header Cache-Control private;
}
But it matches images in /images directory not in any other directory
within the reverse proxy domain.
Please advice how do we properly set browser cache expires while we do
reverse proxy.
Thanks in advance
Posted at Nginx Forum: