Backport Last-Modified and Etag support, close #1415