def add_no_cache_headers(func):
    """
    Makes sure the retrieved file is not cached on disk, or cached by proxy servers in between.
    This would circumvent any checking whether the user may even access the file.
    """

    @wraps(func)
    def _dec(*args, **kwargs):
        response = func(*args, **kwargs)
        response['Expires'] = 'Thu, 01 Jan 1970 00:00:00 GMT'  # HTTP 1.0 proxies
        response['Cache-Control'] = 'max-age=0, no-cache, must-revalidate, proxy-revalidate'  # HTTP 1.1
        return response

    return _dec
Makes sure the retrieved file is not cached on disk, or cached by proxy servers in between.
    This would circumvent any checking whether the user may even access the file.