broser cache expires when reverse proxy use

n1xman nginx-forum at
Fri Jun 24 21:19:26 MSD 2011


We need to cache images while reverse proxy with the following

        location /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 {
        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:,209723,209723#msg-209723

More information about the nginx mailing list