<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 4, 2012, at 5:56 AM, James Lee wrote:</div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font>    location /ssi/ {<br>        ssi on;<br>        expires 1w;<br>        add_header Last-Modified 'not added';<br>    }<br>    location /ssi-with-last-modified/ {<br>        proxy_pass        <a href="http://localhost/ssi/">http://localhost/ssi/</a>;<br>        proxy_set_header  Host <a href="http://www.HOST.co.uk">www.HOST.co.uk</a>;<br>        add_header Last-Modified 'this works!';<br>    }<br><br></div></blockquote></div><br><div>With this config, every request will actually cause two hits to nginx. </div><div><br></div><div>Last-Modified is removed from SSI in every web server I know because you'd really need to show the last modified time of the newest included element. Also, if there are dynamic elements, how do you handle those?</div><div><br></div><div>I did  simple Lua header filter that adds the current time to Last-Modified when needed.  Depending on which browsers you need to support, however, just adding Expires and/or Cache-Control headers is enough to get the browser to cache. I know that not all browsers behave correctly, however.</div><div><br></div><div>Something simple like:</div><div><br></div><div>header_filter_by_lua '</div><div>     ngx.header["Last-Modified"] = ngx.http_time(ngx.time())</div><div>';</div><div><br></div><div>Of course, you may want to check to see if it's already been set, only set if a flag is present, etc.</div><div><br></div><div><br></div><div>The "proxy to yourself" solution is unacceptable for a busy site.</div><div><br></div><div>--Brian</div></body></html>