Don't finish computing the digest more than once and add test that the proxy rewrites the Location header if the file is already cached